Closed kiminuo closed 8 months ago
I don't think it improves the perf. It should be measured. Also, I think N follows the Benford's law. Most Ns are 0 then 1, then 2, then 3 and so on.
I don't think it improves the perf.
You are seem to be right. It goes very much against my intuition but bechmarks confirm your opinion (it's actually much slower in the current benchmark).
Interestingly changing:
-return (a.hash == b.hash && a.n == b.n);
+return (a.hash == b.hash && a.n.CompareTo(b.n) == 0);
seems to show like 8% improvement on the benchmark
dotnet build -c Release --framework net6.0 && dotnet run -c Release -f net6.0 -- --runtimes net6.0 --filter *OutPointBench*
Method | Mean | Error | StdDev |
---|---|---|---|
Old | 539.4 ms | 7.11 ms | 6.30 ms |
New | 479.9 ms | 7.51 ms | 7.03 ms |
I'm not sure why.
I don't want to invest too much time in this PR as the original proved to be a bad one. But if the improvement sounds good and it actually exists, then I can finish this PR.
I have not measured the change but it seems that for many cases it should be faster.