4 ms·
I appreciate that these issues definitely complicate research and benchmarking of VM performance, but I'm confused about this question: "If you're a normal user
by nightpool 4y ago
I appreciate that these issues definitely complicate research and benchmarking of VM performance, but I'm confused about this question: "If you're a normal user, the results suggest that you're often not getting the performance you expect". Is that true? Most VMs are not simple, predictable systems that would ever reach a "steady state"—they're dynamic systems that are constantly executing different parts of the codebase and taking wildly different codepaths at different times. V8 is a great example of this—the type of code executed on a page changes wildly depending on what you're doing and what actions you take. Why would we even want to optimize it for "reaching a steady state", when different parts of the codebase may be more or less useful at different times? It seems more important to me to work on optimizations that can allow us to deoptimize parts of the codebase that we don't think we will be useful again, to save on memory, even if it involves sacrificing this theoretical notion of a "steady state"
- chrisseaton 4y ago> Most VMs are not simple, predictable systems that would ever reach a "steady state"—they're dynamic systems that are constantly executing different parts of the codebase and taking wildly different codepaths at different times. V8 is a great example of this—the type of code executed on a page changes wildly depending on what you're doing and what actions you take. That is already the exact point being made by Laurie and Edd's research. > Why would we even want to optimize it for "reaching a steady state", when different parts of the codebase may be more or less useful at different times? A steady state for whatever the application is doing right now. Not a single, statically known steady state, without considering what it's doing. > It seems more important to me to work on optimizations that can allow us to deoptimize parts of the codebase that we don't think we will be useful again, to save on memory, even if it involves sacrificing this theoretical notion of a "steady state" I think that's a completely solved problem isn't it? You can GC a compiled method. What more do you want?
- dan-robertson 4y agoIt smells like a caching problem rather than a gc problem. Surely the compiled method would be kept live by the pointer from its interpreted cousin or from its class’s vtable or whatever.
- chrisseaton 4y agoIt’s a kind of weak pointer.
- dan-robertson 4y agoYeah I see the comparison, it just feels… weak. With weak pointers there isn’t really much of a ‘gc keeps around objects that are used a lot’ thing going on whereas that fits much more nicely for a cache and for this situation.
- hedora 4y agoAfter thinking about these issues for over a decade, and having the rug repeatedly pulled out from under me by Java, I've come to the conclusion that the easiest path forward is to stick code snippets into godbolt, or to disassemble optimized binaries from ahead of time compiled languages. (I didn't say doing this is easy; just that it is easier than reasoning about a JIT)
- PathOfEclipse 4y agoWhat's the difference in practice between a JIT and an AOT compiler that supports optimizations based on runtime analysis (I forgot the technical term for that. Profile-guided optimization, maybe?)? I think the real issue is, the higher level the language, the harder it is to reason about what your code will actually get compiled down to. If you want predictable performance in Java, or any high-level language, in my experience you have to essentially write C code in that language, or at least get as close as possible. In Java, that usually means: * sticking to primitives or arrays of primitives as much as possible. The language has no support for user-defined value types! * Sticking to regular for loops, while loops, and other similar control structures. * Using offheap memory via Unsafe or similar API when feasible.
- jeffbee 4y agoThe things that most Java applications need to do to reduce the variance of runtime outcomes are sadly a little more basic: use a modern VM, set the compilation flags appropriately, and make sure the code caches are large enough to hold all your hot functions.
- PathOfEclipse 4y agoMy experience leads me to the exact opposite conclusions. For example, your code cache is either big enough or it's not. It's a pretty binary situation and a simple checkbox to ensure your app didn't run out of space. To quote from https://stackoverflow.com/questions/7513185/what-are-reservedcodecachesize-and-initialcodecachesize https://stackoverflow.com/questions/7513185/what-are-reserve...: "Normally you'd not change this value. I think the default values are quite good balanced because this problems occur on very rare occasions only (in my experince)." Similarly, your organization tends to run the version of Java that the whole company supports. I have never worked anywhere where someone was allowed to use a different version than the rest of the company for performance reasons. In contrast, the advice to write low-level code for predictable, high performance has been virtually timeless and generally applicable across languages.
- hinkley 4y ago> the type of code executed on a page changes wildly depending on what you're doing and what actions you take. I can't speak for anyone else, but I feel like one of my goals for mature software is to start factoring out common bits of code so that a lot of the workloads either share code in common, or share output in common (avoiding code re-execution). There's a high correlation between Choose Your Own Adventure code that's doing random stuff for every request and my unhappiness on a project. I usually find at least a few highly effective people on any team who sympathize or agree. If at least 20% of the code isn't "in common" I'm uncomfortable. In common doesn't necessarily mean every task, but multiple tasks. EG, every task runs 5 of these 20 common concerns. I'm a sucker for complementary code and processes though. I am sure that some of my preferences in software design have an origin story in hardware sympathy, some in ergonomics/cognition, and a number in both. I couldn't begin to guess which opinions started with which observation at this point. Did I rationalize a human optimal solution or rationalize a hardware optimal one?
- fulafel 4y agoI think it depends on whether you are thinking about backend code or things like browsers. The results section of the article leads with: The research question in TCPT I am most interested in is RQ1 "Do Java microbenchmarks reach a steady state of performance?"