7 ms·
Don't miss the later comments by Richard Stallman (creator of Emacs), and Tom's reply: Richard> I don't think a 3% speedup is worth those drawbacks. Rich
by dangirsh 8y ago
Don't miss the later comments by Richard Stallman (creator of Emacs), and Tom's reply:
Richard> I don't think a 3% speedup is worth those drawbacks.
Richard> Or even a 10% speedup.
Richard> A really big speedup would justify the costs.
Tom> It is 3x, not 3%.
Mic drop.
- chubot 8y agoMore context: In some simple benchmarks, it is about 3x faster than the bytecode interpreter. I'm always skeptical of statements of these, because workloads vary so much. JITs seem to do well for numerical benchmarks, e.g. summing a list of numbers or the mandelbrot fractal. They seem to do worse with string-based workloads, because the bottleneck is in memory allocations, and I have yet to see a JIT that does anything about that (i.e. analyzing code to reduce allocations). I imagine that ELisp is used mostly for string workloads and not numeric workloads. So I won't be surprised if the 3x number doesn't hold up. I'm interested in hearing more details and happy be to be corrected.
- chrisseaton 8y ago> I have yet to see a JIT that does anything about that (i.e. analyzing code to reduce allocations) You mean you've never seen a JIT that does anything about memory allocations for ELISP? Or do you mean you've never seen a JIT do anything at all about memory allocations? Because removing memory allocations through escape analysis and scalar replacement is a key feature of any sophisticated JIT, and there are definitely many JITs which do this. The JIT for Ruby I work on will effectively remove the allocation of string objects.
- chubot 8y agoHm yes I was wrong about that. It looks like v8 and PyPy do it (which is apparent from some Googling and grepping of the code). I have been reading some papers on JITs and I don't see escape analysis mentioned that often. In the PyPy paper (which is over a decade old) they mention it as future work. Still, I actually tried PyPy on a string-based workload and it was slower than CPython and used more memory. I don't know why but that contributes to my feeling that JITs are bad for string-based workloads. I'm interested in seeing any pointers to benchmarks that show the improvements resulting from escape analysis in JITs. I haven't seen anything like that and I've done a decent amount of research. A cursory look at this blog post makes me think it's not super straightforward: https://v8project.blogspot.com/2017/09/disabling-escape-analysis.html https://v8project.blogspot.com/2017/09/disabling-escape-anal... That post is less than a year old! i.e. the fact that v8 has been around for 10+ years and they're still updating escape analysis makes me wonder what the issue with it is. Is it hard to implement or does it not produce that much speedup? I appreciate any pointers.
- chrisseaton 8y ago> I'm interested in seeing any pointers to benchmarks that show the improvements resulting from escape analysis in JITs. I haven't seen anything like that and I've done a decent amount of research. If you've done a decent amount of research in the field of JITs and you aren't aware of what escape analysis achieves in practice then I'm very surprised. http://www.ssw.uni-linz.ac.at/Research/Papers/Stadler14/Stadler2014-CGO-PEA.pdf http://www.ssw.uni-linz.ac.at/Research/Papers/Stadler14/Stad... That paper is relatively recent, so you can follow the chain of papers from its references.
- mamcx 8y ago>Still, I actually tried PyPy on a string-based workload and it was slower than CPython and used more memory. I don't know why but that contributes to my feeling that JITs are bad for string-based workloads. Now that I'm implementing a interpreter for a relational language and from what I know for why python is slow: https://jakevdp.github.io/blog/2014/05/09/why-python-is-slow/ https://jakevdp.github.io/blog/2014/05/09/why-python-is-slow... And also: https://speakerdeck.com/alex/why-python-ruby-and-javascript-are-slow https://speakerdeck.com/alex/why-python-ruby-and-javascript-... Is challenging to be dynamic and also fast. So, you need to design the language/runtime with performance in mind, or at least, to minimize what could be very slow (that is what I'm triying).
- 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-...
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]