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:

  1. 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?
  2. 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?
  3. comparing c++, if source closed means no 3rd party lib, low-latency system, there way force optimization upfront increase performance closer of c++?
  4. 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.
  5. 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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -