Skip to content

Commit

Permalink
benchmarks wip
Browse files Browse the repository at this point in the history
  • Loading branch information
masklinn committed May 5, 2023
1 parent fd395ce commit df661dc
Show file tree
Hide file tree
Showing 3 changed files with 815 additions and 0 deletions.
15 changes: 15 additions & 0 deletions benchmarks/bench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pathlib

import pyperf
from ua_parser.user_agent_parser import Parse, _PARSE_CACHE


f = pathlib.Path(__file__).parent / 'useragents.txt'
uas = f.read_text('utf-8').splitlines(keepends=False)

runner = pyperf.Runner()
runner.timeit("legacy", """
for ua in uas:
Parse(ua)
""", "from __main__ import Parse, uas, _PARSE_CACHE")

Loading

0 comments on commit df661dc

Please sign in to comment.