Skip to content

Instantly share code, notes, and snippets.

  • There are multiple tiers of compilation: a hot method will first be compiled with a quick, instrumented compile, then (if the method stays hot), it can be optimized further with more expensive compiles.

  • OpenJDK counts method invocations and backedges (loops) to decide when to JIT a block of code. A hot method, a hot loop, or a warm loop in a warm method will get JITed.

  • HotSpot doesn't start measuring until the program has had a little time to start up and begin its normal workload.

  • When JITing a loop, the interpreter's stack frame needs to be translated since the memory layout used by the compiled code may be different.

  • The earlier tiers of compilation generate various levels of instrumentation (which has overhead) to decide whether it's worth continuing to measure and optimize and also to determine what speculative optimizations may be useful (if a virtual call always goes to the same target, that target could be inlined).

Keybase proof

I hereby claim:

  • I am fedidat on github.
  • I am fedidat (https://keybase.io/fedidat) on keybase.
  • I have a public key whose fingerprint is E8B1 91FE E2F9 A8C6 27AC 4999 BD80 30EF 3283 5F39

To claim this, I am signing this object:

@fedidat
fedidat / nativeJavaScript.js
Created October 31, 2017 07:45 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests