Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Java story is slightly more complex. Javac has emitted code to make a StringBuilder and call append multiple times on it, and then the JIT has spotted this construction and optimised that.

This is, as you can guess, somewhat fragile especially when some of the parts may be constants. So JEP 280 has changed javac to emit an invokeDynamic instruction with information about the constant and dynamic parts of the string so the optimisation strategy can be chosen at run time and can change over time without requiring everyone to recompile their java code.



However one should mention that this optimization is Hotspot specific and other Java compilers will behave differently.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: