README, and support script cleanup.

This commit is contained in:
2026-09-08 23:47:50 +00:00
parent a7fdb4ddf3
commit 319aa52a6f
3 changed files with 41 additions and 61 deletions
+3 -4
View File
@@ -34,7 +34,6 @@ from user_agent_parser import parse as uap_parse
from user_agents import parse as uas_parse
from uarite import uaparse
from uarite.core import _parse_client
ALL_DOMAINS = (
ua_parser.Domain.USER_AGENT | ua_parser.Domain.OS | ua_parser.Domain.DEVICE
@@ -284,8 +283,8 @@ def safe(fn):
def cache_info(name):
if name == "uarite":
i = _parse_client.cache_info()
return f"{i.hits} hits / {i.misses} misses (cap 1024, browsers only)"
i = uaparse.cache_info()
return f"{i.hits} hits / {i.misses} misses (cap 1024)"
if name == "user-agent-parser":
from user_agent_parser.parser import _cached_parse_user_agent
@@ -324,7 +323,7 @@ def bench():
):
fn = safe(fn)
fn("Warmup/1.0 (+https://example.com/warmup)")
_parse_client.cache_clear()
uaparse.cache_clear()
t = timeit.timeit(lambda: [fn(u) for u in work], number=1)
res[name] = t / len(work) * 1e6
return res, len(work)
+1 -1
View File
@@ -20,7 +20,7 @@ import matplotlib
matplotlib.use("Agg")
matplotlib.rcParams["svg.fonttype"] = "path" # text as paths: renders anywhere
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt # noqa: E402
# µs per cold parse, from scripts/bench.py.
US = {