3 ms·
>I have yet to see a JIT that does anything about that (i.e. analyzing code to reduce allocations). Most JITs do this. LuaJIT does allocation sinking of tables
by PeCaN 8y ago
>I have yet to see a JIT that does anything about that (i.e. analyzing code to reduce allocations).
Most JITs do this. LuaJIT does allocation sinking of tables, strings, and even C-FFI structs. HotSpot does escape analysis of everything. IIRC Graal can even do partial escape analysis (allocate the object on the stack and then copy it to the heap if it escapes on one code path). I imagine the major JavaScript engines are similar. It's a well-known performance optimization.
- chubot 8y agoYes I was wrong about that [1], but now I'm interested in any benchmarks / performance evaluation of escape analysis in JITs :) From what I gather, it's a lot more important in PyPy because integers and floats are boxed! [1] https://news.ycombinator.com/item?id=17761452 https://news.ycombinator.com/item?id=17761452
- mamcx 8y agoAny source in how escape analysis is implemented? Is only usefull for JIT or also for "normal" bytecode interpreter?
- chrisseaton 8y agoTraditional escape analysis uses algorithms like equi-escape sets. https://www.usenix.org/legacy/events/vee05/full_papers/p111-kotzmann.pdf https://www.usenix.org/legacy/events/vee05/full_papers/p111-...