performance - When does java JIT have wrong optimization? -
jit method optimization (-xx:+printcompilation) after 10k invocations , can configure -xx:compilethreshold. read reason not lower threshold jit optimization might wrong or optimize infrequently used code. have few questions regarding area:
- i think wrong optimization (ie: on-stack-replacement) due lazy classloading of polymorphic methods. after 3 implementations (i think) found, jvm index table lookup. of course, speed suffers if have more polymorphic impl. polymorphic method cause or major cause wrong jit optimization? if not, others?
- what if force loading classes @ astartup jvm can build such index tables upfront, isn't better overall optimization upfront? what's wrong optimize-all approach? what's cost if goal speed?
- comparing c++, if source closed means no 3rd party lib, low-latency system, there way force optimization upfront increase performance closer of c++?
- peter lawrey mentioned in oracle magazine article can kick-in jit artificially run enough test data in production meet threshold. doing seems dangerous in production env , 1 mishap fired. there must better way min risk.
- any reference topic (involves java & c++) appreciated.
updated: #3. never should expect java faster c++, want closer.
is there way force optimization upfront increase performance better of c++?
nope. it's fundamental limitation of semantics enforced in java specification , way jvm ecosystem works slower c++ implementation, assuming equivalent quality of implementation , code. have @ my existing answer on subject more details.
Comments
Post a Comment