3 ms·
Are they really searching the static source in real time with the threads? This is what I understand from the description. Why don't they use something like Luc
by alpb 15y ago
Are they really searching the static source in real time with the threads? This is what I understand from the description. Why don't they use something like Lucene, I believe the searched content is pretty much static, so why wouldn't just index? Wouldn't that be much faster?
- nelhage 15y agoLucene, and most other indexing solutions (to my knowledge) index based on words, not arbitrary substrings. So they can efficiently answer questions like "Give me all documents containing the word 'Linus'", but not necessarily "All documents containing the string '#def'". That said, I am indexing -- I have my own custom backend that stores an in-memory index that lets me do arbitrary substring search (and more complicated queries, such as most character classes) much faster than a full search. That said, the backend will fall back on a full regex search if necessary.
- durin42 15y agoDo you use anything like a trigram index (see rsc's wonderful posts about how Google Code Search worked, and https://code.google.com/p/codesearch/ https://code.google.com/p/codesearch/ for a Go implementation) to speed up the regex codepath?
- nelhage 15y agoI'm using a different data structure -- a suffix array -- but the concept is pretty similar. I started work on this before Russ released his codesearch implementation, but I did read his blog posts while I was working on this.