Hacker News new | ask | show | jobs
by tgv 757 days ago
Not ideal. It is very slow. It takes 8 seconds for 3400 strings. That might be fine for occasional offline usage, but not for frequent usage, and certainly not for use in the backend (although I agree it should not be used there). I guess it matches all regexps against each string.

It also misses some really common user agents, basically all iOS 11 and 12. They may be rare nowadays, but they still occur.

1 comments

It seems to recompile every regex on every matching operation. This is really slow. The compiled regexes should be cached in the different matchers.
Good point. I didn't give much attention to this part. I run some benchmarks and move these to compile only once. Thank you.