Re:Benchmarking 20 programming languages on N-queens and mat...
by spense on Wednesday January 03, 2024 @08:19AM
(#38853702)
C, Nim and Zig all benefit from static allocation and it's available in rust, so seems fair?
also, `const N` is used in rust's nqueen test, so figured it would be fine.
someone posted an `.iter().zip()` solution which benchmarks only a little slower (+10ms) than static allocation:
https://github.com/attractivechaos/plb2/pull/4#issuecomment-...
Re:Benchmarking 20 programming languages on N-queens and mat...
by Aissen on Wednesday January 03, 2024 @08:41AM
(#38853920)
I only looked at the C version, and it didn't use a generic over the allocation size, although yes, technically it was fixed at compile time.
I saw the update to the PR, but I still prefer my collect()-based version :-)
Edit: I have tried making an iterator-based version to elide bound checks, but had to resort to unsafe, and it's barely 50% faster than the original rust version (not as fast as C): https://gist.github.com/anisse/6b580628206293ef242faa7db6219...
Edit 2: updated, and my rust iterator version now ~equivalent to C with no unsafe.
Edit 3: too late, the repo has been updated with an other iterator-based version that is just as fast.