Programming-Language-Benchmarks icon indicating copy to clipboard operation
Programming-Language-Benchmarks copied to clipboard

C# algorithms are completely outdated

Open mnns opened this issue 2 years ago • 6 comments

No use of Memory<T> or Span<T> / ReadOnlyMemory etc. Code is non optimized... Thanks

mnns avatar Jun 24 '22 06:06 mnns

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.

bpecsek avatar Jun 24 '22 10:06 bpecsek

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?

asaf92 avatar Aug 03 '22 09:08 asaf92

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

hanabi1224 avatar Aug 03 '22 10:08 hanabi1224

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?

asaf92 avatar Aug 03 '22 13:08 asaf92

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

hanabi1224 avatar Aug 03 '22 13:08 hanabi1224

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".

JoaoVictorVP avatar Jul 13 '23 15:07 JoaoVictorVP