Comment

Comment by tomsmeding

Interesting that this is fast! I looked at the code and it looks like a super vanilla (prefix) trie, at least for exact match searching. For approximate searching, it seems to just explore the trie from the endpoint of the word in the query; it I understand correctly, if wouldn't find "banana" given the query "baana" and some tolerance.

The readme says that the trie has some tricks to make it fast; the only such trick that I could find is "fast properties", which seems to be a JS-specific thing to make object property access faster (something with promoting an ad-hoc object to a prototype, which presumably enjoys more optimisation in JS engines).

Hence I'm sort-of surprised that this performs well! If a simple trie is sufficient for that, I might go forward with implementing search for some of my other stuff just like that.

parent tomsmeding 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton