Hacker News new | ask | show | jobs
by s_ngularity 2972 days ago
Depends on how often you need to search. The implementation of the parallel linear search in Go is a lot easier to get right than what you’re recommending.

Though I would certainly agree that paying for more vm cores just so you can do a linear search on each of them is a bit silly

1 comments

The linear search code should probably be in a library, and in fact often is, if you have the GNU extension memmem().

I'm also not convinced that it's that hard. This seems to be the new cult; just because someone buggered up binary search with an integer overflow once, we're not going to write non-pathological algorithms anymore?

I’m not saying it’s a bad idea to implement it, but there’s a greater time cost, and if the performance gains aren’t worth the effort, then there’s no reason to make the improvement
Fair enough. I guess you would figure out how long it takes to either clag the code from somewhere else or write it yourself and plug in the math at the bottom of the page (as they are trying to quantify the value of doing this).

I strongly suspect dragging in memmem() would be the most cost effective way of doing this and run in the most places, even if it's a non-standard GNU libc extension.