Remainder operation (%
) performance in Linux vs Windows and macOS
#90667
Replies: 3 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
Can you show disasm for both? via |
Beta Was this translation helpful? Give feedback.
-
I was hinted this could 'just' be because of the different processors used on GH actions runners: And I just verified that's the case: Ubuntu run in Intel Xeon CPU E5-2673 v4 2.30GHz, with similar results than same benchmarks in Windows/Ubuntu and equivalent processorBenchmarkDotNet v0.13.7, Ubuntu 22.04.3 LTS (Jammy Jellyfish) Intel Xeon CPU E5-2673 v4 2.30GHz, 1 CPU, 2 logical and 2 physical cores .NET SDK 8.0.100-preview.7.23376.3 [Host] : .NET 8.0.0 (8.0.23.37506), X64 RyuJIT AVX2 DefaultJob : .NET 8.0.0 (8.0.23.37506), X64 RyuJIT AVX2
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
While running some unrelated benchmarks (to compare
x % y
andx & (y-1)
when y is a power of two), I found some surprising results in the%
part:Remainder operations (
%
) in Ubuntu seems to be twice faster than the same operations in Windows or macOS, at least for the test cases I tried.Am I approaching this wrong? Is there a documented reason for this to happen?
And more importantly, is there room for improvement?
Edit: I've been hinted this could be because of the different processors used on GH actions runners:
Intel Xeon CPU E5-2673 v4 2.30GHz
andIntel Xeon CPU E5-1650 v2 3.50GHz
in Windows and mac vsIntel Xeon Platinum 8370C CPU 2.80GHz
in Linux.Benchmark code
Benchmark results (using GH Actions)
Results for (2,4,8,16,32,64,128,256,512,1024) * 1024 * 1024 (power of two)
https://github.com/lynx-chess/Lynx/actions/runs/5879633929
Results for (3,5,9,17,33,65,129,257,513,1025) * 1024 * 1024
https://github.com/lynx-chess/Lynx/actions/runs/5879866516
Beta Was this translation helpful? Give feedback.
All reactions