12 ms·
I am really struggling to understand the benchmark output quoted. Can anyone elaborate what does benchmark=3/4 ns mean, and the count? Is the set-up part of th
by necovek 7y ago
I am really struggling to understand the benchmark output quoted.
Can anyone elaborate what does benchmark=3/4 ns mean, and the count? Is the set-up part of the benchmark (test structure suggest not, but just to make sure)?
The only way I can read it is that 4000 divisions takes 4ns, and 4000 shift-rights takes 3ns, but that only has 1 digit of precision, which makes it unusable for comparison, but even then suggests a 25%/33% difference, which is not insignificant.
Also, the VM seems to optimise multiply out, so it must be doing it for a reason.
- thechao 7y agoIt's definitely not 4000 divisions per 4ns — that'd imply a terahertz computer. I think it's saying that the amortized cost of 4000 divisions is 4ns per division. Small integer division is an "easy win" for a dedicated HW path, so it doesn't surprise me that it's only a little slower than a shift-right. Variable length right shifts aren't that fast.
- bonzini 7y agoIt's not small integer division that is being benchmarked, the JIT compiler has reduced it to an addition, a conditional move and a right shift. This sequence is then benchmarked against the right shift.
- saagarjha 7y agoART is an AOT complier, is it not?
- monocasa 7y agoIt's both AOT and JIT. https://source.android.com/devices/tech/dalvik/jit-compiler https://source.android.com/devices/tech/dalvik/jit-compiler
- pjmlp 7y agoWith a PGO cache updated across execution runs and devices (since Android 10 PGO data is shared across the Play Store).
- ignoramous 7y agoFor anyone like me wondering what a PGO is: https://source.android.com/devices/tech/perf/pgo https://source.android.com/devices/tech/perf/pgo