News for hackers. Stuff that matters.
Re:14,000x Speedup (2015) by mumblemumble on Tuesday October 13, 2020 @10:12AM (#24765698)
Re:14,000x Speedup (2015) by monksy on Tuesday October 13, 2020 @01:14PM (#24767562)
That was a great write up explaining about not seeing the forest for the trees. However, it is still infuriating that we're getting these leetcode questions in interviews to see how much you can hack and optimize a toy problem. (As if you had lots of time to think about it and work through it)
Re:14,000x Speedup (2015) by mynegation on Tuesday October 13, 2020 @12:09PM (#24766891)
Ha! Great story, thank you! Clearly shows that computational complexity by itself is not very useful without knowing the assumptions. It is one thing to see substring search and immediately pattern match it to something from CS course like Boyer-Moore or Knuth-Morris-Pratt, but these algorithms require pre-processing that makes sense only if you know you are going to search for the same pattern repeatedly. Pure library function cannot make that assumption, and REPNE instruction is just an icing on a cake.
Re:14,000x Speedup (2015) by ghusbands on Tuesday October 13, 2020 @03:55PM (#24769617)
> pre-processing that makes sense only if you know you are going to search for the same pattern repeatedly

The pre-processing is typically worth it if you're searching through a large string, even just once.

Re:14,000x Speedup (2015) by antisthenes on Tuesday October 13, 2020 @12:06PM (#24766862)
That was a great read for someone who's used VBA to solve business cases, including InStr.

Anecdata, but most of my strings were indeed short (searching for manufacturer SKUs inside arrays of other SKUs).