Better HN
topnewbestaskshowjobs
Log inSign up

mhdm

6 karma · joined Jun 27, 2023 (3y ago) · 11 submissions

Submissions

comment 3y ago · link · parent

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).

comment 3y ago · link · parent

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.

comment 3y ago · link · parent

Thanks, updated the footnote.

comment 3y ago · link · parent

Prefetching is the right tradeoff for large arrays. Addressed at the end of the article: https://mhdm.dev/posts/sb_lower_bound/#prefetching

comment 3y ago · link · parent

It was meant to link to rust's binary search implementation. Updated to https://doc.rust-lang.org/1.71.1/src/core/slice/mod.rs.html#...

comment 3y ago · link · parent

Author here. I'm open to feedback and happy to answer questions.

7.

Fastest Branchless Binary Search(mhdm.dev ↗)

4 points · by mhdm · 3y ago · 1 comment

comment 3y ago · link · parent

Author here, I'm open to feedback and happy to answer questions.

9.

Branchless Binary Search – 2x faster than C++ std:lower_bound()(mhdm.dev ↗)

2 points · by mhdm · 3y ago · 1 comment

comment 3y ago · link · parent

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.