You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can see that it first computes the log of the counter using BSR on line 3705. This is then compared to the threshold on L3707, which then leads us (or the CPU) down the approximate counting path.
My question is: Why does the code compare the log of the counter with the threshold, and not the counter directly? IMHO the code could've been written this way, eliminating the BSR for the non-approximate case:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I noticed the Scalable statistics counters of the JIT in a profile today. @AndyAyersMS have written a very helpful documentation about the counters here: https://github.com/dotnet/runtime/blob/main/docs/design/features/ScalableApproximateCounting.md
This is the actual code from the JIT:
runtime/src/coreclr/vm/jithelpers.cpp
Lines 3693 to 3721 in 35e23f7
You can see that it first computes the log of the counter using BSR on line 3705. This is then compared to the threshold on L3707, which then leads us (or the CPU) down the approximate counting path.
My question is: Why does the code compare the log of the counter with the threshold, and not the counter directly? IMHO the code could've been written this way, eliminating the BSR for the non-approximate case:
Beta Was this translation helpful? Give feedback.
All reactions