4 ms·
It seems like he makes two errors 1) He thinks that you can retarget C++ code compiled to LLVM BC to multiple targets. That's not the case, you can only JIT LL
by pieter 17y ago
It seems like he makes two errors
1) He thinks that you can retarget C++ code compiled to LLVM BC to multiple targets. That's not the case, you can only JIT LLVM BC to the platform you're targetting with your C++ code. That means that you might just as well take LLVM out of the picture, and compare Java vs. C++.
2) Java vs. C++ on 'work/watt' is almost the same as Java vs. C++ on 'work/time', given that you keep the same machine to run it on. You'll have to keep CPU utilization maximised for both, which doesn't seem unreasonable. The only thing you then have to care about is memory utilization. If Java takes (for example) 2x as much memory as C++, then just look up how much power the extra memory uses and add that to your measure. All the other stuff (Background tasks, JIT'ing, GC'ing, whatever) is already part of the 'work/time' benchmark, so you don't have to care about that.
- chibea 17y agoRight, it would be more interesting to talk about memory consumption and if that might add to power consumption.
- bad_user 17y ago"That means that you might just as well take LLVM out of the picture, and compare Java vs. C++." Not really, if you can dynamically load libraries at runtime, then you can separate the platform-dependent code from the main codebase, making it possible to target multiple targets without recompilation. "The only thing you then have to care about is memory utilization" I don't know much about the JVM internals, but isn't JIT'ing a more expensive process (as in CPU + memory) for the JVM? If you keep the CPU load maximized for both, won't more of those resources be used by the JVM's JIT'ing and GC'ing?
- pieter 17y ago"Not really, if you can dynamically load libraries at runtime, then you can separate the platform-dependent code from the main codebase, making it possible to target multiple targets without recompilation." It's not just libraries. It also stuff like the size of pointers and integers and the way that structs are aligned and packed. "I don't know much about the JVM internals, but isn't JIT'ing a more expensive process (as in CPU + memory) for the JVM? If you keep the CPU load maximized for both, won't more of those resources be used by the JVM's JIT'ing and GC'ing?" It doesn't matter how the JIT works, if you just measure performance. The JIT is just an internal thing, which you don't have to care about if you do the right benchmarks. The only thing you're interested in is is stuff like requests/second, and you shouldn't care how that is handled (through a JIT, interpreter, or native code).