开发者

C code is very slow using it as java native code

i call a C code, as native code, from Java with JNI. So, i had created a dll and I load it from Java code. It's very strange but if I run the same C code as .exe It's more fast than the same code used as native code. Why?? I use Windows开发者_JAVA技巧 7 64 bit, jdk 32 bit, Cygwin, a dll at 32 bit Is there any difference between debug and release mode building a dll?


There is certainly a difference between debug and release mode. In debug mode the compiler will avoid aggressive optimizations because they tend to make debugging harder. In release mode it will not. So if your .exe is built in release mode and your DLL in debug mode, that could produce the effect you describe. (Whether it actually is the cause of the difference, there isn't enough information here to say. Can you make sure both are built the same way and report back on whether the speed difference goes away?)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜