Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> At this stage, I could spend time optimizing the code. Ideas include (thanks to Andrey Petrov) isolating int-to-byte conversions, using bitmaps to determine leading zero bytes, and reducing allocations by using arrays.

Another easy speed up would be using an intrinsic [0] to count leading zeroes which would just call the lzcnt instruction [1] (or equivalent) and skip the need for a loop for difficulty <=64.

[0]: https://doc.rust-lang.org/std/primitive.u32.html#method.lead...

[1]: https://www.felixcloutier.com/x86/lzcnt



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: