News for hackers. Stuff that matters.
Re:Java StringBuffer and StringBuilder performance by Someone on Tuesday June 14, 2016 @01:45AM (#11900032)
You're right, I forgot that all methods are implicitly virtual by default in Java.
Re:Java StringBuffer and StringBuilder performance by vardump on Tuesday June 14, 2016 @03:49AM (#11900443)
Not quite same as "virtual" in C++ though. Java methods can still be inlined at runtime.

I wish C++ had a runtime that could do same, inline smaller virtual methods, function pointers and shared library (.dll/.dylib/.so) calls at runtime.

It could also do other transformations, like optimize those branches away it can prove to be always true or false. It could flatten most abstractions, removing redundant parameter checks and call frame setups/teardowns. It could also do CPU (instruction set) specific optimizations.

I think C++ runtime that does this partial JITting is possible, but not easy. However, the benefits are interesting. While getting there won't be easy, you can achieve faster than native performance.

Something like this has already been actually done. Some examples below.

QuaC: http://digitalassets.lib.berkeley.edu/techreports/ucb/text/C...

DynamoRio: DynamoRio had some early success JITting native binaries resulting faster than native performance. Unfortunately current versions are slower than native.

https://github.com/DynamoRIO/dynamorio).

https://dspace.mit.edu/bitstream/handle/1721.1/87441/5486358...