to:FAX2U (FAX)

sevencat 2004-11-28 10:03:34
mov ecx, [eax] : NULLCHK, LENGTH, ecx = LI7
cmp edx, ecx : BNDCHK
jae ThrowArrayIdxOutOfBndExcp : BNDCHK
mov ecx, [eax+edx*4+8] : IALOAD, ecx = LI6

而且这边还多了一个检查数组溢出的吧?
C或C++是不检查的,应该会快些吧?

能解释一下吗?
...全文
173 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sevencat 2004-11-29
  • 打赏
  • 举报
回复
昨天晚上无聊呢。不想做事,做为娱乐活动还是可以接受的。
xiayiping 2004-11-29
  • 打赏
  • 举报
回复
为了这些无聊的事情争执下去有什么用呢?
sevencat 2004-11-28
  • 打赏
  • 举报
回复
java的博大精深不是你现在能理解的。
将来你也许会是位高手,就冲这股执着精神,预先祝福你一下。
sevencat 2004-11-28
  • 打赏
  • 举报
回复
有些东西确实只有JIT能做到:

比如中提到:
http://www.idiom.com/~zilla/Computer/javaCbenchmark.html

The compiler knows what processor it is running on, and can generate code specifically for that processor。
JIT编译器知道什么处理器正在运行,可以产生对应此处理器的优化代码。在这一点上,C++的静态编译器肯定做不到。
//嗯,这样就是为每个处理器都要先预编译一下,只不过每次JAVA帮你做一次,而C++要手工做,对不同的处理器做优化,看看VC的链接选项就知道了,还有LINUX包后面的i386,i586,i686就知道了,而且我觉得他优化得不够,还可以手工汇编优化。




# The compiler knows what processor it is running on, and can generate code specifically for that processor. It knows whether (for example) the processor is a PIII or P4, if SSE2 is present, and how big the caches are. A pre-compiler on the other hand has to target the least-common-denominator processor, at least in the case of commercial software.

# Because the compiler knows which classes are actually loaded and being called, it knows which methods can be de-virtualized and inlined. (Remarkably, modern java compilers also know how to "uncompile" inlined calls in the case where an overriding method is loaded after the JIT compilation happens.)
这个比较复杂,不好翻译,自己看吧
你觉得C++编译器做不到这点吗?你知道intel C++编译器现在能做得多好吗?

# A dynamic compiler may also get the branch prediction hints right more often than a static compiler.
动态编译器可以进行更准确的分支预测,从而可以提前取入指令
你觉得C++编译器做不到这点吗?你知道intel C++编译器现在能做得多好吗?
sevencat 2004-11-28
  • 打赏
  • 举报
回复
不指望你靠这段程序来告诉我JAVA比C或者C++快了。
今天俺撤了。

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧