mhdm
Re:Fastest Branchless Binary Search
on Friday August 11, 2023 @06:02PM (#37094607)
For a proper/sane forward iterator, front[index] is the same thing as *(front + index) and front + index achieves the same as std::advance(front, index) (just not in place).
Or are you pointing out how first[length] and first += length + rem would technically result in advancing a forward iterator through to first + length twice? (Trivially fixed with a middle = first + length temporary variable btw).
Re:Fastest Branchless Binary Search
on Friday August 11, 2023 @05:11PM (#37094085)
Then you'll want to look at https://mhdm.dev/posts/sb_lower_bound/#prefetching
100mb is large enough that the branchy version turns out to have a slight advantage, more due to quirks of x86 (speculative execution) rather than being better.
Re:Fastest Branchless Binary Search
on Friday August 11, 2023 @05:00PM (#37093969)
Thanks, updated the footnote.
Re:Fastest Branchless Binary Search
on Friday August 11, 2023 @04:09PM (#37093387)
Prefetching is the right tradeoff for large arrays. Addressed at the end of the article: https://mhdm.dev/posts/sb_lower_bound/#prefetching
Re:Fastest Branchless Binary Search
on Friday August 11, 2023 @04:04PM (#37093318)
Should have linked to rust's binary search implementation. Updated to https://doc.rust-lang.org/1.71.1/src/core/slice/mod.rs.html#...
Re:Fastest Branchless Binary Search
on Saturday July 01, 2023 @10:49AM (#36550701)
Author here. I'm open to feedback and happy to answer questions.
Re:Branchless Binary Search – 2x faster than C++ std:lower_bound()
on Thursday June 29, 2023 @06:02PM (#36527391)
Author here, I'm open to feedback and happy to answer questions.
Branchless Binary Search – 2x faster than C++ std:lower_bound()
Re:The Password Game
on Tuesday June 27, 2023 @07:26PM (#36500125)
Awesome game. Didn't think it was possible to LOSE at picking a password but there you have it. LOST at finding a 16m48s youtube video and a lovely passw0R.513mayIshellXXXV8pfxxtractAusingaporeRh8+ iamenough
When entering the chess game moves make sure to add `x` when taking a piece, `+` when checking, and `#` for checkmate.