3 ms·
Regexp search is slower. SQLite's support for regexp comes from an external library (sqlite3-pcre) that most of the time isn't installed on the host system. Eve
by andmarios 10y ago
Regexp search is slower. SQLite's support for regexp comes from an external library (sqlite3-pcre) that most of the time isn't installed on the host system. Even when it is, it doesn't always work.
My solution around this, is, when regexp is enabled, to query for all the history and then have Go perform the regexp search itself —the normal is to let SQLite perform the search.
Depending on your CPU and history size, you may need a couple seconds for the result. For example when the server process runs on an Atom processor and the history is about 150.000 lines long, a regexp search takes about 7 seconds. A normal search with a wildcard on the same machine and history database, needs only 1 second.
- inetknght 10y agoIf it's slower, then use a simpler query or come up with a way to improve the back-end search speed (which you did, it looks like). My point is that novice developers don't usually work with that size of data. And if they are working with that size of data, then both regex and performance are good things for them to learn :)