You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each parse takes ~2ms on my machine, and it's pretty common throughout the life of a running
process, to parse identical user-agent strings. This adds a very primitive cache similar in vein
to the cache inside the `urlparse` package.
Before:
```
$ python -m timeit -s 'from ua_parser.user_agent_parser import Parse' 'Parse("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.52 Safari/537.36")'
100 loops, best of 3: 2.14 msec per loop
```
After:
```
$ python -m timeit -s 'from ua_parser.user_agent_parser import Parse' 'Parse("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.52 Safari/537.36")'
1000000 loops, best of 3: 0.956 usec per loop
```
0 commit comments