languages icon indicating copy to clipboard operation
languages copied to clipboard

Zig arrays to be stack-allocated

Open PDeveloper opened this issue 11 months ago • 3 comments

I have:

  • [x] Read the project README, including the benchmark descriptions

Description of changes

To be closer to the C or Fortran versions, use stack-allocated arrays in the Zig version instead of dynamically heap-allocated arrays, providing more accurate results.

PDeveloper avatar Jan 13 '25 11:01 PDeveloper

you should also remove the std.mem.eql at the top of levehenstein. C version isn't doing that. also I don't believe the benchmark is comparing eql strings anyway, so you're just doing more work without payout.

gwenzek avatar Jan 13 '25 13:01 gwenzek

See this comment on why the arrays are heap allocated.

D-Berg avatar Jan 16 '25 07:01 D-Berg

In order to be able to use arbitrary input sizes, stack-allocated arrays at comptime with fixed sizes are no longer an option.

zierf avatar Jan 25 '25 19:01 zierf