Hacker Newsnew | past | comments | ask | show | jobs | submit | urcyanide's commentslogin

Rewriting it in Rust not only brings high performance, but also adopts more feature requests from the community.


Thanks for pointing out. I have updated the post. I use the opposite shift since I store the binary in u64 with a different endian from the C++ version. Sorry for the confusion, my bad.


Endian indicates the byte order (MSB->LSB, LSB->MSB), but does not change the representation of a bit. The conditional logic says that an even result is 32 and an odd is 0 after a modulus two. In binary that (x & 1) is 0 for even and 1 for odd. When you shift by 5 that is 0 for even and 32 for odd, which is the opposite of the conditional logic. This is why I suggested using a binary NOT to flip the bits so that you get the same result as the original.


Sorry for the confusing example. The bitwise one is correct since I store the binary in u64 with a different endian from the C++ version. (this happens because the C++ version is using a numpy script to do the preprocessing) My bad, I should explain it in a better way. Will update the post.


Yes, i&32 is more readable.


Not really, i \in (0..dim).step_by(32), shift \in {0, 32}, but for `i % 32` it's 0..32


Sorry, I wrote `i % 32` by accident, I meant `i & 32`.


The end2end QPS is about 3x of the 1st Rust version on both SIFT & GIST datasets.


I also see the profiling shows that the "iter::next" takes a large percentage in the flamegraph. Are they the same reason?


Thanks for pointing out, this can be optimized by the compiler when enabling opt-level=3


It has the same QPS as the C++ version for GIST dataset. While Rust has more SIMD, C++ has const generic. I guess there is still some space for future improvement.


Oh nice, the article already changed.

I can't quite imagine it's the exact same though in all metrics. Some graphs of measurement statistics would be even better.


Some potential issues about Python multiprocessing https://blog.mapotofu.org/blogs/python-multiprocessing/. COW is quite tricky. BTW, most of the related official Python docs doesn’t mention the usage under ‘spawn’.


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

Search: