4 ms·
Are there any compiler features which change the ratio power consumption/clock cycles? If yes, that's what he should have talked about and give some evidence.
by chibea 17y ago
Are there any compiler features which change the ratio power consumption/clock cycles? If yes, that's what he should have talked about and give some evidence.
If no, let's assume power consumption is a linear function of clock cycles and focus on cycles.
He claims JIT would cause 'periodically run background optimizer tasks'. He does not actually state if he is talking about single or multi-processor systems.
Let's assume first, he is talking about a single-processor system. Then, the background tasks are actually run on the same CPU and thus are counted in the benchmarks.
If he, instead, is talking about a multi-processor (-core) system, he claims that even in a single threaded benchmark, there might be hidden cost (hidden, since runtime is improved by 'stealing' cycles from another CPU) inflected by these background tasks. He is probably right here, since besides JIT, there is e.g. garbage collection which in fact might be running concurrently on another thread. If you only measure runtime of such a benchmark it won't be an accurate measure of the power consumption. But: If you measure CPU-time/cycles of the benchmark all the threads are taken into account with all the 'hidden' costs. He provides no evidence that the benchmarks failed to do this.
What he could have meant is that some benchmarks use 'warm-up' to have all the hot spots JITed before measuring. He's right here: for short running tasks JIT has to be taken into account. For long running (massive data processing) tasks it is at least not obvious that JITing is slower or faster than ahead-of-time compiling. There are some opportunities for a JIT-compiler to actually use less cycles than AOT-compiled code. E.g. a virtual method call in C++ has to use the virtual function table always, this indirection might introduce additional cycles due to bad locality. A JIT compiler knowing that a particular interface call at a call-site in fact is monomorphic, can optimistically skip one level of indirection and thus save cycles.
The vendors of JIT compiler put much effort in the balance between JIT overhead and possible performance gain. One can assume that they know how to create meaningful benchmarks. If in doubt, provide counter-examples.
BTW: The correct unit of comparison would have been work/joule and not work/watt.
- wglb 17y ago"BTW: The correct unit of comparison would have been work/joule and not work/watt." Well, work in this context seems to imply scaled computations/second and since watts is a per-second unit, work/watt would be the right measure.
- Nelson69 17y agoThere are compiler research projects to build power optimizing compilers rather than just pure performance optimizing compilers. I was going to post a link or two but when I googled I found dozens and dozens of them, so take your pick. I don't have a good idea of what kind of difference that they can make yet. The article's whole premise seems to be that C++ code is linearly faster than Java code so that linear difference must also be there for power consumption. The differences in power consumption for memory are pretty small. We'd need some numbers to judge whether or not that's interesting and it'd also be interesting to see a JVM optimized for power consumption and how that factored in to the equation. The disk usage is probably the largest user of energy in these systems, presumably a C implementation and Java implementation would use the same disk layout so disk usage should be roughly the same. The hyptertable guys think the performance differences are worth it to use C/C++ but they don't mention power consumption differences.