Programming-Language-Benchmarks
Programming-Language-Benchmarks copied to clipboard
C# algorithms are completely outdated
No use of Memory<T> or Span<T> / ReadOnlyMemory etc. Code is non optimized... Thanks
You can fork the repository, optimize the codes and send a PR. If your codes are according to the rules the site maintainer accepts them and your new codes will be bench-marked.
The binary tress benchmark was using structs but a PR removed them intentionally. Is there a policy saying that you have to use unoptimized code or something similar?
The binary tress benchmark was using structs
@asaf92 It was removed because the 'optimization' is unfair in terms of heap allocation and the number it shows is misleading, it's also been removed from the CLBG site for a long time
Why is using structs unfair? It's a legitimate way to avoid garbage collection when writing high performance code.
EDIT: I'm asking because I don't mind optimizing the C# algorithms, but I don't understand what's considered fair and what's not. Are stack allocations forbidden in all algorithms?
It's a legitimate way to avoid garbage collection when writing high performance code.
Yes, except that this particular problem was originally designed to benchmark perf of boehm gc and heap allocations, the struct trick halves the number of heap allocations and just makes the comparison unfair and invalid
And what reason do you have for bringing it up? It's not like other languages don't have tricks like auto-allocating on the stack via escape parsing or compiler optimizations. Structs are extremely normal in C# and they are part of the code written everyday by millions of developers, I don't see how this is "unfair".