Live data from Hacker News

Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

tratt.net

41–50 of 93 posts

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#41

Earlier quoted context omitted.

It’s much harder than that because the JIT is speculating on what lots of objects in the heap are doing, including watchpointing them to constant fold properties. It’s not clear what the key should be in that case. Still not impossible but I want to be clear on what exactly makes this hard. CPU model for example is not what makes it hard.

> including watchpointing them I assume this isn't literally using hardware watchpoints?

Yeah

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#42
post #5

Ugh at risk of being the grumpy old programmer: jit code is just never going to touch actual handwritten native code in performance. It's been like 50 years. If we care about performance we need languages for it.

I agree that we need to design languages that take into account advanced optimizations, but we're pretty far from the limit of compiler optimizations - partly because many languages have inconvenient semantics for it. We haven't even begun to leverage data layout optimizations and there's a lot of things about feedback directed partial application style transformations that haven't made it out of academia to production compilers.

In some sense we can always fully specialize a program to its current input and make a lot of radical changes to data layout and represesentation. But in languages like C/C++ where programs can "see" struct/array layout, member order, pointers as integer values that have fixed order, spacing, grouping based on the program specified data types, this is prohibitively complicated.

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#43

Earlier quoted context omitted.

That would be great but it’s hard because the trick, at least in JS VMs, is to have the JIT specialize based on the heap. So you’d need a heap snapshot or some way to link the generated code to a different heap. Maybe not impossible, just hard enough that it’s not widespread.

It does seem like you could do JIT with a persistent cache which stores the JIT output along with a key that's a hash of all the relevant system parameters like CPU model and VM parameters like heap size. This would mean that the typical case of re-running a program in the same environment would be pre-warmed.

Heap layout changes between runs due to OS obfuscation (ASLR).

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#44
post #11

Stupid question for people who know more about these things. Why can’t we fight the warmup time by running an already warmed up snapshot of the program? Or say dumping some data structure when it hits steady state to give hints to the JIT the next time it runs?

Emacs does this. See https://emacs.stackexchange.com/questions/2364/what-is-the-f...

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#45

I love intellij idea, but it's pretty damn slow for a lot of things (though never quite as bad as eclipse). I have always wondered if the JVM is optimizing for tasks that happen at startup, at the expense of performance during use. It would be a shame if the slow performance simply came down to the JVM profiling at startup and determining that the core function of the entire program was to index the code in your work…

Slow compared to? VSCode? Visual Studio? Vim?

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#46
These tests could be on a website of their own. I'd love to see how the results change with time and how competing implementations compare in terms of behavior (not necessarily performance), V8 especially has changed a lot but it wouldn't surprise me if it still ran into issues.

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#47
post #9

Earlier quoted context omitted.

I mostly agree, but compilers intentionally don't explore every optimization path to save compilation time, and a JIT is able to trace the program for real data and find places that could benefit from additional attention. I don't think JITs are the only way to address that trade-off in compilation time vs runtime performance metrics, and whether their benefits are worth their other costs is an interesting, program-d…

Any languages explore both? Compile to native and run with a jit which profiles and optimizes further based on runtime behavior?

Its called profile guided optimization, although they don’t run with an actual JIT. The big 3 C compilers all have it.

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#48

The reality is... it's been decades and while JVM languages can be pretty fast, I have yet to see many non-contrived examples where the VM based language consistently outperforms competently written but not heavily optimized C++. Even then, extensive tuning is done to the VM. Heck, with the advent of Go you now have another great higher level language that consistently outperforms Java/Scala, has top notch garbage co…

According to The Computer Language Benchmarks Game, Go performance is in the same ballpark as Java, and sometimes several times slower:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#49

The reality is... it's been decades and while JVM languages can be pretty fast, I have yet to see many non-contrived examples where the VM based language consistently outperforms competently written but not heavily optimized C++. Even then, extensive tuning is done to the VM. Heck, with the advent of Go you now have another great higher level language that consistently outperforms Java/Scala, has top notch garbage co…

> Go ... has top notch garbage collection

Is ballast[1] still required for certain use cases?

[1]: https://blog.twitch.tv/en/2019/04/10/go-memory-ballast-how-i...

Re: Why Aren’t More Users More Happy With Our VMs? Part 1 (2018)

#50
post #11

Stupid question for people who know more about these things. Why can’t we fight the warmup time by running an already warmed up snapshot of the program? Or say dumping some data structure when it hits steady state to give hints to the JIT the next time it runs?

The V8 snapshot feature is designed for this. https://v8.dev/blog/custom-startup-snapshots
Post reply on HN