Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ae4fab180 | ||
|
|
5bbd9a5484 |
@@ -1,8 +1,6 @@
|
|||||||
# User-Agent Parsing Done Right
|
# User-Agent Parsing Done Right
|
||||||
|
|
||||||
There are plenty of UA parsers for Python: ua-parser is the official Python port of the large upstream project, while user-agents builds on top of it with higher-level device detection. Among newer implementations, user-agent-parser is the most promising and is included here for comparison.
|
This module takes a smaller, faster, modern approach to User-Agent parsing. It's a dependency-free pure-Python parser weighing only 25 kB, with strong handling of current browsers and crawlers. Despite its light weight, uarite identifies both browsers and crawlers more accurately than any competing implementation tested here.
|
||||||
|
|
||||||
This module takes a smaller, faster, modern approach. It's a dependency-free pure-Python parser weighing only 25 kB, with strong handling of current browsers and crawlers. Despite its light weight, uarite identifies both browsers and crawlers more accurately than any competing implementation tested here.
|
|
||||||
|
|
||||||
It returns structured classification, but also the thing most applications eventually need: **a short pretty description**.
|
It returns structured classification, but also the thing most applications eventually need: **a short pretty description**.
|
||||||
|
|
||||||
@@ -52,56 +50,61 @@ The engine and os fields are intentionally broad. The kind field distinguishes b
|
|||||||
|
|
||||||
Detection is necessarily limited by what the User-Agent reveals. Crawlers can masquerade as ordinary browsers or other crawlers, so sites that need stronger identification should use additional methods rather than relying on UA detection alone.
|
Detection is necessarily limited by what the User-Agent reveals. Crawlers can masquerade as ordinary browsers or other crawlers, so sites that need stronger identification should use additional methods rather than relying on UA detection alone.
|
||||||
|
|
||||||
## Accuracy
|
## Comparison
|
||||||
|
|
||||||
The table below compares representative User-Agent formats with ua-parser. user-agents produces nearly identical results and is left out.
|
There are plenty of UA parsers for Python. This comparison includes the ua-parser family — the official port of the large upstream project, benchmarked with all three of its regex backends (Python, RE2, Rust) — plus user-agents, which builds on it with higher-level device detection, and fastuaparser, a single-file heuristic parser in the same weight class as uarite. Among those excluded: user-agent-parser crashes on real-world strings; httpagentparser misidentifies most bots and browser OSes; device-detector has a massive 26 MB install and extremely slow parsing; and crawlerdetect only distinguishes bots from non-bots. The user-agents package has been unmaintained since 2020 but is kept as a reference point.
|
||||||
|
|
||||||
| Case | uarite¹ | ua-parser² |
|
Installed size tracks the design. The minimal heuristic parsers are tiny: fastuaparser installs in 15 kB, uarite in 30 kB. Everything built on ua-parser's regex database starts around half a megabyte, and its accelerated backends add several megabytes of native code.
|
||||||
| ---------------------------- | ------------------------- | --------------------------------------------- |
|
|
||||||
| Chrome, Windows | Chrome/152 Windows | Chrome/152 Windows |
|
|
||||||
| Safari, macOS | Safari/18 macOS | Safari/18 Mac OS X Mac |
|
|
||||||
| Opera, Linux | Opera/106 Linux | Opera/106 Linux |
|
|
||||||
| Chrome, Android (no model) | Chrome/152 Android | Chrome Mobile/152 Android K❌ |
|
|
||||||
| Chrome, Android (Pixel) | Chrome/118 Pixel 6 | Chrome Mobile/118 Android Pixel 6 |
|
|
||||||
| Edge, Android (model code) | Edge/110 Galaxy S7 | Edge Mobile/110 Android Samsung SM-G930P |
|
|
||||||
| Firefox, Android | Firefox/154 Android 15 | Firefox Mobile/154 Android Generic Smartphone |
|
|
||||||
| Safari, iPhone | iPhone iOS 17 | Mobile Safari/17 iOS iPhone |
|
|
||||||
| Huawei HarmonyOS phone | HuaweiBrowser/6 HarmonyOS | Huawei Browser/6 Android❌ Huawei Browser |
|
|
||||||
| GPTBot | GPTBot (AI) | GPTBot/1 Spider |
|
|
||||||
| Googlebot (disguised) | Googlebot (search) | Googlebot/2 Android❌ Spider |
|
|
||||||
| Facebook preview (disguised) | Facebook | FacebookBot/1 Android Pixel 7 ❌ |
|
|
||||||
| Meta crawler (disguised) | Meta-ExternalAgent (AI) | Chrome/145 Windows ❌ |
|
|
||||||
| WhatsApp preview | WhatsApp | WhatsApp/10 Spider |
|
|
||||||
| Bytespider | Bytespider | Bytespider/ Android❌ Generic Smartphone |
|
|
||||||
| BingPreview | BingPreview | BingPreview/1 Windows❌ Spider |
|
|
||||||
| AhrefsBot | AhrefsBot | AhrefsBot/7 Spider |
|
|
||||||
| python-requests | python-requests/2.32.5 | Python Requests/2 |
|
|
||||||
|
|
||||||
- ❌ marks an incorrect data such as OS from disquise or Android 10; K (compat) on modern devices
|
|
||||||
- ¹ `r.pretty` shown as is
|
|
||||||
- ² `{r.user_agent.family}/{r.user_agent.major} {r.os.family} {r.device.family}`
|
|
||||||
|
|
||||||
On our modern-browser test set, **uarite resolves family, version, and OS at 100%**. ua-parser and user-agents score 80%, while user-agent-parser reaches 92%.
|
|
||||||
|
|
||||||
Crawler detection was tested against real-world UAs from [monperrus/crawler-user-agents](https://github.com/monperrus/crawler-user-agents). user-agent-parser scored 32%, user-agents 60%, and ua-parser 64%. **uarite scores 97%**, identifying the specific crawler by name in 80% of cases.
|
|
||||||
|
|
||||||
The benchmark and test scripts are available in the repository's scripts folder.
|
The benchmark and test scripts are available in the repository's scripts folder.
|
||||||
|
|
||||||
## Performance
|
### Accuracy
|
||||||
|
|
||||||
Import and first parse takes about **10 ms** for uarite, compared with 50–90 ms for ua-parser depending on backend.
|
The table below compares representative User-Agent formats with fastuaparser and ua-parser. The user-agents wrapper produces nearly identical results to ua-parser and is left out.
|
||||||
|
|
||||||

|
| Case | uarite¹ | fastuaparser² | ua-parser³ |
|
||||||
_User-Agents parsed per second per CPU core, first parse of unseen strings, with equal shares of browser and crawler UAs. One-off setup costs excluded._
|
| ---------------------------- | ------------------------- | ------------------------- | --------------------------------------------- |
|
||||||
|
| Chrome, Windows | Chrome/152 Windows | Chrome - Windows | Chrome/152 Windows |
|
||||||
|
| Safari, macOS | Safari/18 macOS | Safari - Mac OS X | Safari/18 Mac OS X Mac |
|
||||||
|
| Opera, Linux | Opera/106 Linux | Opera - Linux | Opera/106 Linux |
|
||||||
|
| Chrome, Android (no model) | Chrome/152 Android | Chrome - Android Mobile | Chrome Mobile/152 Android K❌ |
|
||||||
|
| Chrome, Android (Pixel) | Chrome/118 Pixel 6 | Chrome - Android Mobile | Chrome Mobile/118 Android Pixel 6 |
|
||||||
|
| Edge, Android (model code) | Edge/110 Galaxy S7 | Edge - Android Mobile | Edge Mobile/110 Android Samsung SM-G930P |
|
||||||
|
| Firefox, Android | Firefox/154 Android 15 | Firefox - Android Mobile | Firefox Mobile/154 Android Generic Smartphone |
|
||||||
|
| Safari, iPhone | iPhone iOS 17 | Safari - iOS Mobile | Mobile Safari/17 iOS iPhone |
|
||||||
|
| Huawei HarmonyOS phone | HuaweiBrowser/6 HarmonyOS | Chrome - Android Mobile❌ | Huawei Browser/6 Android❌ Huawei Browser |
|
||||||
|
| GPTBot | GPTBot (AI) | Bot | GPTBot/1 Spider |
|
||||||
|
| Googlebot (disguised) | Googlebot (search) | Bot | Googlebot/2 Android❌ Spider |
|
||||||
|
| Facebook preview (disguised) | Facebook | Chrome - Android Mobile❌ | FacebookBot/1 Android Pixel 7 ❌ |
|
||||||
|
| Meta crawler (disguised) | Meta-ExternalAgent (AI) | Bot | Chrome/145 Windows ❌ |
|
||||||
|
| WhatsApp preview | WhatsApp | Browser - Other❌ | WhatsApp/10 Spider |
|
||||||
|
| Bytespider | Bytespider | Bot | Bytespider/ Android❌ Generic Smartphone |
|
||||||
|
| BingPreview | BingPreview | Browser - Windows❌ | BingPreview/1 Windows❌ Spider |
|
||||||
|
| AhrefsBot | AhrefsBot | Bot | AhrefsBot/7 Spider |
|
||||||
|
| python-requests | python-requests/2.32.5 | Other | Python Requests/2 |
|
||||||
|
|
||||||
All parsers cache results. With cache hits, **uarite reaches about 36 million lookups per second**, compared with about 5 million for ua-parser and 600 000 for user-agents.
|
- ❌ marks incorrect data such as an OS from disguise, Android 10; K (compat) on modern devices, or a missed identity
|
||||||
|
- ¹ `r.pretty` shown as is
|
||||||
|
- ² `parse_ua(ua)` shown as is
|
||||||
|
- ³ `{r.user_agent.family}/{r.user_agent.major} {r.os.family} {r.device.family}`
|
||||||
|
|
||||||
|
On our modern-browser test set, scoring only fully correct results (family, version, and OS all right): **uarite 100%**, ua-parser and user-agents 79%. The fastuaparser heuristic resolves the family and OS in 91% of cases, but reports no version numbers at all, so it cannot be scored on the full criterion.
|
||||||
|
|
||||||
|
Crawler detection was tested against [real world UAs](https://github.com/monperrus/crawler-user-agents): **uarite 97%**, fastuaparser 84%, ua-parser 64%, user-agents 60%.
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
Import and first parse takes about **10 ms** for uarite and effectively nothing for fastuaparser, compared with 50–90 ms for ua-parser depending on backend.
|
||||||
|
|
||||||
|

|
||||||
|
_User-Agents parsed per second per CPU core, first parse of unseen strings, with equal shares of browser and crawler UAs. One-off setup costs excluded. Cached results and fastuaparser (1 million) are left out of the graph._
|
||||||
|
|
||||||
|
On raw speed fastuaparser wins: a few string searches per UA, no cache needed. The trade-off shows in the accuracy table above — no versions, no crawler names. All other parsers cache results. With cache hits, **uarite reaches about 36 million lookups per second**, compared with about 5 million for ua-parser and 600 000 for user-agents.
|
||||||
|
|
||||||
## Why yet another UA parser
|
## Why yet another UA parser
|
||||||
|
|
||||||
Rather than relying on a large historical regex database, the parser focuses on modern UA formats and parses them directly, choosing the most specific interpretation available. This keeps the implementation small while handling today's browsers and crawler traffic well.
|
Rather than relying on a large historical regex database, the parser focuses on modern UA formats and parses them directly, choosing the most specific interpretation available. This keeps the implementation small while handling today's browsers and crawler traffic well. Until now, I had been using those other modules and building my own pretty-UA formatting on top of them, fixing by post processing issues the upstream didn't care of.
|
||||||
|
|
||||||
Until now, I had been using those other modules and building my own pretty-UA formatting on top of them, fixing by post processing issues the upstream didn't care of.
|
|
||||||
|
|
||||||
Eventually it became easier to start over with a parser designed around modern traffic. The result is uarite.
|
Eventually it became easier to start over with a parser designed around modern traffic. The result is uarite.
|
||||||
|
|
||||||
Hopefully it helps you too.
|
Hopefully it helps you too. Star my [GitHub](https://github.com/leovasanko/uarite) if it did.
|
||||||
|
|||||||
+267
-285
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="864pt" height="122.4pt" viewBox="0 0 864 122.4" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="758.3677pt" height="86.04pt" viewBox="0 0 758.3677 86.04" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
||||||
<metadata>
|
<metadata>
|
||||||
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||||
<cc:Work>
|
<cc:Work>
|
||||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||||
<dc:date>2026-09-08T21:11:49.096249</dc:date>
|
<dc:date>2026-09-09T18:32:39.096963</dc:date>
|
||||||
<dc:format>image/svg+xml</dc:format>
|
<dc:format>image/svg+xml</dc:format>
|
||||||
<dc:creator>
|
<dc:creator>
|
||||||
<cc:Agent>
|
<cc:Agent>
|
||||||
@@ -21,67 +21,128 @@
|
|||||||
</defs>
|
</defs>
|
||||||
<g id="figure_1">
|
<g id="figure_1">
|
||||||
<g id="patch_1">
|
<g id="patch_1">
|
||||||
<path d="M 0 122.4
|
<path d="M 0 86.04
|
||||||
L 864 122.4
|
L 758.3677 86.04
|
||||||
L 864 0
|
L 758.3677 0
|
||||||
L 0 0
|
L 0 0
|
||||||
L 0 122.4
|
L 0 86.04
|
||||||
z
|
z
|
||||||
" style="fill: none"/>
|
" style="fill: none"/>
|
||||||
</g>
|
</g>
|
||||||
<g id="axes_1">
|
<g id="axes_1">
|
||||||
<g id="patch_2">
|
<g id="patch_2">
|
||||||
<path d="M 2 115.018182
|
<path d="M 1.44 80.82
|
||||||
L 23.088517 115.018182
|
L 38.571238 80.82
|
||||||
L 23.088517 99.852921
|
L 38.571238 67.958589
|
||||||
L 2 99.852921
|
L 1.44 67.958589
|
||||||
z
|
z
|
||||||
" clip-path="url(#pc2d639e53a)" style="fill: #6e6e6e"/>
|
" clip-path="url(#p4041b231bc)" style="fill: #6e6e6e"/>
|
||||||
</g>
|
</g>
|
||||||
<g id="patch_3">
|
<g id="patch_3">
|
||||||
<path d="M 2 96.523961
|
<path d="M 1.44 65.135353
|
||||||
L 23.934681 96.523961
|
L 40.996285 65.135353
|
||||||
L 23.934681 81.3587
|
L 40.996285 52.273942
|
||||||
L 2 81.3587
|
L 1.44 52.273942
|
||||||
z
|
z
|
||||||
" clip-path="url(#pc2d639e53a)" style="fill: #6e6e6e"/>
|
" clip-path="url(#p4041b231bc)" style="fill: #6e6e6e"/>
|
||||||
</g>
|
</g>
|
||||||
<g id="patch_4">
|
<g id="patch_4">
|
||||||
<path d="M 2 78.029741
|
<path d="M 1.44 49.450705
|
||||||
L 93.465629 78.029741
|
L 169.540418 49.450705
|
||||||
L 93.465629 62.86448
|
L 169.540418 36.589295
|
||||||
L 2 62.86448
|
L 1.44 36.589295
|
||||||
z
|
z
|
||||||
" clip-path="url(#pc2d639e53a)" style="fill: #6e6e6e"/>
|
" clip-path="url(#p4041b231bc)" style="fill: #6e6e6e"/>
|
||||||
</g>
|
</g>
|
||||||
<g id="patch_5">
|
<g id="patch_5">
|
||||||
<path d="M 2 59.53552
|
<path d="M 1.44 33.766058
|
||||||
L 153.330472 59.53552
|
L 317.786457 33.766058
|
||||||
L 153.330472 44.370259
|
L 317.786457 20.904647
|
||||||
L 2 44.370259
|
L 1.44 20.904647
|
||||||
z
|
z
|
||||||
" clip-path="url(#pc2d639e53a)" style="fill: #6e6e6e"/>
|
" clip-path="url(#p4041b231bc)" style="fill: #6e6e6e"/>
|
||||||
</g>
|
</g>
|
||||||
<g id="patch_6">
|
<g id="patch_6">
|
||||||
<path d="M 2 41.0413
|
<path d="M 1.44 18.081411
|
||||||
L 400.418079 41.0413
|
L 671.04 18.081411
|
||||||
L 400.418079 25.876039
|
L 671.04 5.22
|
||||||
L 2 25.876039
|
L 1.44 5.22
|
||||||
z
|
z
|
||||||
" clip-path="url(#pc2d639e53a)" style="fill: #2b6cb0"/>
|
" clip-path="url(#p4041b231bc)" style="fill: #2b6cb0"/>
|
||||||
</g>
|
|
||||||
<g id="patch_7">
|
|
||||||
<path d="M 2 22.547079
|
|
||||||
L 862 22.547079
|
|
||||||
L 862 7.381818
|
|
||||||
L 2 7.381818
|
|
||||||
z
|
|
||||||
" clip-path="url(#pc2d639e53a)" style="fill: #6e6e6e"/>
|
|
||||||
</g>
|
</g>
|
||||||
<g id="text_1">
|
<g id="text_1">
|
||||||
<!-- user-agents 3 000 -->
|
<!-- 3 100 user-agents -->
|
||||||
<g style="fill: #767676" transform="translate(33.408517 111.957453) scale(0.11 -0.11)">
|
<g style="fill: #767676" transform="translate(46.606438 78.658335) scale(0.11 -0.11)">
|
||||||
<defs>
|
<defs>
|
||||||
|
<path id="DejaVuSans-16" d="M 2597 2516
|
||||||
|
Q 3050 2419 3304 2112
|
||||||
|
Q 3559 1806 3559 1356
|
||||||
|
Q 3559 666 3084 287
|
||||||
|
Q 2609 -91 1734 -91
|
||||||
|
Q 1441 -91 1130 -33
|
||||||
|
Q 819 25 488 141
|
||||||
|
L 488 750
|
||||||
|
Q 750 597 1062 519
|
||||||
|
Q 1375 441 1716 441
|
||||||
|
Q 2309 441 2620 675
|
||||||
|
Q 2931 909 2931 1356
|
||||||
|
Q 2931 1769 2642 2001
|
||||||
|
Q 2353 2234 1838 2234
|
||||||
|
L 1294 2234
|
||||||
|
L 1294 2753
|
||||||
|
L 1863 2753
|
||||||
|
Q 2328 2753 2575 2939
|
||||||
|
Q 2822 3125 2822 3475
|
||||||
|
Q 2822 3834 2567 4026
|
||||||
|
Q 2313 4219 1838 4219
|
||||||
|
Q 1578 4219 1281 4162
|
||||||
|
Q 984 4106 628 3988
|
||||||
|
L 628 4550
|
||||||
|
Q 988 4650 1302 4700
|
||||||
|
Q 1616 4750 1894 4750
|
||||||
|
Q 2613 4750 3031 4423
|
||||||
|
Q 3450 4097 3450 3541
|
||||||
|
Q 3450 3153 3228 2886
|
||||||
|
Q 3006 2619 2597 2516
|
||||||
|
z
|
||||||
|
" transform="scale(0.015625)"/>
|
||||||
|
<path id="DejaVuSans-62" transform="scale(0.015625)"/>
|
||||||
|
<path id="DejaVuSans-14" d="M 794 531
|
||||||
|
L 1825 531
|
||||||
|
L 1825 4091
|
||||||
|
L 703 3866
|
||||||
|
L 703 4441
|
||||||
|
L 1819 4666
|
||||||
|
L 2450 4666
|
||||||
|
L 2450 531
|
||||||
|
L 3481 531
|
||||||
|
L 3481 0
|
||||||
|
L 794 0
|
||||||
|
L 794 531
|
||||||
|
z
|
||||||
|
" transform="scale(0.015625)"/>
|
||||||
|
<path id="DejaVuSans-13" d="M 2034 4250
|
||||||
|
Q 1547 4250 1301 3770
|
||||||
|
Q 1056 3291 1056 2328
|
||||||
|
Q 1056 1369 1301 889
|
||||||
|
Q 1547 409 2034 409
|
||||||
|
Q 2525 409 2770 889
|
||||||
|
Q 3016 1369 3016 2328
|
||||||
|
Q 3016 3291 2770 3770
|
||||||
|
Q 2525 4250 2034 4250
|
||||||
|
z
|
||||||
|
M 2034 4750
|
||||||
|
Q 2819 4750 3233 4129
|
||||||
|
Q 3647 3509 3647 2328
|
||||||
|
Q 3647 1150 3233 529
|
||||||
|
Q 2819 -91 2034 -91
|
||||||
|
Q 1250 -91 836 529
|
||||||
|
Q 422 1150 422 2328
|
||||||
|
Q 422 3509 836 4129
|
||||||
|
Q 1250 4750 2034 4750
|
||||||
|
z
|
||||||
|
" transform="scale(0.015625)"/>
|
||||||
|
<path id="DejaVuSans-3" transform="scale(0.015625)"/>
|
||||||
<path id="DejaVuSans-58" d="M 544 1381
|
<path id="DejaVuSans-58" d="M 544 1381
|
||||||
L 544 3500
|
L 544 3500
|
||||||
L 1119 3500
|
L 1119 3500
|
||||||
@@ -290,86 +351,31 @@ L 594 3500
|
|||||||
L 594 4494
|
L 594 4494
|
||||||
L 1172 4494
|
L 1172 4494
|
||||||
z
|
z
|
||||||
" transform="scale(0.015625)"/>
|
|
||||||
<path id="DejaVuSans-3" transform="scale(0.015625)"/>
|
|
||||||
<path id="DejaVuSans-16" d="M 2597 2516
|
|
||||||
Q 3050 2419 3304 2112
|
|
||||||
Q 3559 1806 3559 1356
|
|
||||||
Q 3559 666 3084 287
|
|
||||||
Q 2609 -91 1734 -91
|
|
||||||
Q 1441 -91 1130 -33
|
|
||||||
Q 819 25 488 141
|
|
||||||
L 488 750
|
|
||||||
Q 750 597 1062 519
|
|
||||||
Q 1375 441 1716 441
|
|
||||||
Q 2309 441 2620 675
|
|
||||||
Q 2931 909 2931 1356
|
|
||||||
Q 2931 1769 2642 2001
|
|
||||||
Q 2353 2234 1838 2234
|
|
||||||
L 1294 2234
|
|
||||||
L 1294 2753
|
|
||||||
L 1863 2753
|
|
||||||
Q 2328 2753 2575 2939
|
|
||||||
Q 2822 3125 2822 3475
|
|
||||||
Q 2822 3834 2567 4026
|
|
||||||
Q 2313 4219 1838 4219
|
|
||||||
Q 1578 4219 1281 4162
|
|
||||||
Q 984 4106 628 3988
|
|
||||||
L 628 4550
|
|
||||||
Q 988 4650 1302 4700
|
|
||||||
Q 1616 4750 1894 4750
|
|
||||||
Q 2613 4750 3031 4423
|
|
||||||
Q 3450 4097 3450 3541
|
|
||||||
Q 3450 3153 3228 2886
|
|
||||||
Q 3006 2619 2597 2516
|
|
||||||
z
|
|
||||||
" transform="scale(0.015625)"/>
|
|
||||||
<path id="DejaVuSans-62" transform="scale(0.015625)"/>
|
|
||||||
<path id="DejaVuSans-13" d="M 2034 4250
|
|
||||||
Q 1547 4250 1301 3770
|
|
||||||
Q 1056 3291 1056 2328
|
|
||||||
Q 1056 1369 1301 889
|
|
||||||
Q 1547 409 2034 409
|
|
||||||
Q 2525 409 2770 889
|
|
||||||
Q 3016 1369 3016 2328
|
|
||||||
Q 3016 3291 2770 3770
|
|
||||||
Q 2525 4250 2034 4250
|
|
||||||
z
|
|
||||||
M 2034 4750
|
|
||||||
Q 2819 4750 3233 4129
|
|
||||||
Q 3647 3509 3647 2328
|
|
||||||
Q 3647 1150 3233 529
|
|
||||||
Q 2819 -91 2034 -91
|
|
||||||
Q 1250 -91 836 529
|
|
||||||
Q 422 1150 422 2328
|
|
||||||
Q 422 3509 836 4129
|
|
||||||
Q 1250 4750 2034 4750
|
|
||||||
z
|
|
||||||
" transform="scale(0.015625)"/>
|
" transform="scale(0.015625)"/>
|
||||||
</defs>
|
</defs>
|
||||||
<use xlink:href="#DejaVuSans-58"/>
|
<use xlink:href="#DejaVuSans-16"/>
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(63.375 0)"/>
|
<use xlink:href="#DejaVuSans-62" transform="translate(63.625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(115.46875 0)"/>
|
<use xlink:href="#DejaVuSans-14" transform="translate(95.40625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(177 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(159.03125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-10" transform="translate(211.71875 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(222.65625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(247.796875 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(286.28125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-4a" transform="translate(309.078125 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(318.0625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(372.5625 0)"/>
|
<use xlink:href="#DejaVuSans-58" transform="translate(349.84375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-51" transform="translate(434.09375 0)"/>
|
<use xlink:href="#DejaVuSans-56" transform="translate(413.21875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-57" transform="translate(497.46875 0)"/>
|
<use xlink:href="#DejaVuSans-48" transform="translate(465.3125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(536.671875 0)"/>
|
<use xlink:href="#DejaVuSans-55" transform="translate(526.84375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(588.765625 0)"/>
|
<use xlink:href="#DejaVuSans-10" transform="translate(561.5625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(620.546875 0)"/>
|
<use xlink:href="#DejaVuSans-44" transform="translate(597.640625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-16" transform="translate(652.328125 0)"/>
|
<use xlink:href="#DejaVuSans-4a" transform="translate(658.921875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-62" transform="translate(715.953125 0)"/>
|
<use xlink:href="#DejaVuSans-48" transform="translate(722.40625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(747.734375 0)"/>
|
<use xlink:href="#DejaVuSans-51" transform="translate(783.9375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(811.359375 0)"/>
|
<use xlink:href="#DejaVuSans-57" transform="translate(847.3125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(874.984375 0)"/>
|
<use xlink:href="#DejaVuSans-56" transform="translate(886.515625 0)"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g id="text_2">
|
<g id="text_2">
|
||||||
<!-- ua-parser 3 100 -->
|
<!-- 3 300 ua-parser -->
|
||||||
<g style="fill: #767676" transform="translate(34.254681 93.463233) scale(0.11 -0.11)">
|
<g style="fill: #767676" transform="translate(49.031485 62.973687) scale(0.11 -0.11)">
|
||||||
<defs>
|
<defs>
|
||||||
<path id="DejaVuSans-53" d="M 1159 525
|
<path id="DejaVuSans-53" d="M 1159 525
|
||||||
L 1159 -1331
|
L 1159 -1331
|
||||||
@@ -396,44 +402,49 @@ Q 1681 391 2138 391
|
|||||||
Q 2594 391 2855 752
|
Q 2594 391 2855 752
|
||||||
Q 3116 1113 3116 1747
|
Q 3116 1113 3116 1747
|
||||||
z
|
z
|
||||||
" transform="scale(0.015625)"/>
|
|
||||||
<path id="DejaVuSans-14" d="M 794 531
|
|
||||||
L 1825 531
|
|
||||||
L 1825 4091
|
|
||||||
L 703 3866
|
|
||||||
L 703 4441
|
|
||||||
L 1819 4666
|
|
||||||
L 2450 4666
|
|
||||||
L 2450 531
|
|
||||||
L 3481 531
|
|
||||||
L 3481 0
|
|
||||||
L 794 0
|
|
||||||
L 794 531
|
|
||||||
z
|
|
||||||
" transform="scale(0.015625)"/>
|
" transform="scale(0.015625)"/>
|
||||||
</defs>
|
</defs>
|
||||||
<use xlink:href="#DejaVuSans-58"/>
|
<use xlink:href="#DejaVuSans-16"/>
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(63.375 0)"/>
|
<use xlink:href="#DejaVuSans-62" transform="translate(63.625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-10" transform="translate(124.65625 0)"/>
|
<use xlink:href="#DejaVuSans-16" transform="translate(95.40625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-53" transform="translate(160.734375 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(159.03125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(224.21875 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(222.65625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(285.5 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(286.28125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(326.609375 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(318.0625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(378.703125 0)"/>
|
<use xlink:href="#DejaVuSans-58" transform="translate(349.84375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(440.234375 0)"/>
|
<use xlink:href="#DejaVuSans-44" transform="translate(413.21875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(481.34375 0)"/>
|
<use xlink:href="#DejaVuSans-10" transform="translate(474.5 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(513.125 0)"/>
|
<use xlink:href="#DejaVuSans-53" transform="translate(510.578125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-16" transform="translate(544.90625 0)"/>
|
<use xlink:href="#DejaVuSans-44" transform="translate(574.0625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-62" transform="translate(608.53125 0)"/>
|
<use xlink:href="#DejaVuSans-55" transform="translate(635.34375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-14" transform="translate(640.3125 0)"/>
|
<use xlink:href="#DejaVuSans-56" transform="translate(676.453125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(703.9375 0)"/>
|
<use xlink:href="#DejaVuSans-48" transform="translate(728.546875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(767.5625 0)"/>
|
<use xlink:href="#DejaVuSans-55" transform="translate(790.078125 0)"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g id="text_3">
|
<g id="text_3">
|
||||||
<!-- ua-parser (RE2) 13 000 -->
|
<!-- 14 000 ua-parser (RE2) -->
|
||||||
<g style="fill: #767676" transform="translate(103.785629 74.969012) scale(0.11 -0.11)">
|
<g style="fill: #767676" transform="translate(177.575618 47.28904) scale(0.11 -0.11)">
|
||||||
<defs>
|
<defs>
|
||||||
|
<path id="DejaVuSans-17" d="M 2419 4116
|
||||||
|
L 825 1625
|
||||||
|
L 2419 1625
|
||||||
|
L 2419 4116
|
||||||
|
z
|
||||||
|
M 2253 4666
|
||||||
|
L 3047 4666
|
||||||
|
L 3047 1625
|
||||||
|
L 3713 1625
|
||||||
|
L 3713 1100
|
||||||
|
L 3047 1100
|
||||||
|
L 3047 0
|
||||||
|
L 2419 0
|
||||||
|
L 2419 1100
|
||||||
|
L 313 1100
|
||||||
|
L 313 1709
|
||||||
|
L 2253 4666
|
||||||
|
z
|
||||||
|
" transform="scale(0.015625)"/>
|
||||||
<path id="DejaVuSans-b" d="M 1984 4856
|
<path id="DejaVuSans-b" d="M 1984 4856
|
||||||
Q 1566 4138 1362 3434
|
Q 1566 4138 1362 3434
|
||||||
Q 1159 2731 1159 2009
|
Q 1159 2731 1159 2009
|
||||||
@@ -528,102 +539,35 @@ Q 928 4138 513 4856
|
|||||||
z
|
z
|
||||||
" transform="scale(0.015625)"/>
|
" transform="scale(0.015625)"/>
|
||||||
</defs>
|
</defs>
|
||||||
<use xlink:href="#DejaVuSans-58"/>
|
<use xlink:href="#DejaVuSans-14"/>
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(63.375 0)"/>
|
<use xlink:href="#DejaVuSans-17" transform="translate(63.625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-10" transform="translate(124.65625 0)"/>
|
<use xlink:href="#DejaVuSans-62" transform="translate(127.25 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-53" transform="translate(160.734375 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(159.03125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(224.21875 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(222.65625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(285.5 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(286.28125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(326.609375 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(349.90625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(378.703125 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(381.6875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(440.234375 0)"/>
|
<use xlink:href="#DejaVuSans-58" transform="translate(413.46875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(481.34375 0)"/>
|
<use xlink:href="#DejaVuSans-44" transform="translate(476.84375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-b" transform="translate(513.125 0)"/>
|
<use xlink:href="#DejaVuSans-10" transform="translate(538.125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-35" transform="translate(552.140625 0)"/>
|
<use xlink:href="#DejaVuSans-53" transform="translate(574.203125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-28" transform="translate(621.625 0)"/>
|
<use xlink:href="#DejaVuSans-44" transform="translate(637.6875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-15" transform="translate(684.8125 0)"/>
|
<use xlink:href="#DejaVuSans-55" transform="translate(698.96875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-c" transform="translate(748.4375 0)"/>
|
<use xlink:href="#DejaVuSans-56" transform="translate(740.078125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(787.453125 0)"/>
|
<use xlink:href="#DejaVuSans-48" transform="translate(792.171875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(819.234375 0)"/>
|
<use xlink:href="#DejaVuSans-55" transform="translate(853.703125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-14" transform="translate(851.015625 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(894.8125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-16" transform="translate(914.640625 0)"/>
|
<use xlink:href="#DejaVuSans-b" transform="translate(926.59375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-62" transform="translate(978.265625 0)"/>
|
<use xlink:href="#DejaVuSans-35" transform="translate(965.609375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1010.046875 0)"/>
|
<use xlink:href="#DejaVuSans-28" transform="translate(1035.09375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1073.671875 0)"/>
|
<use xlink:href="#DejaVuSans-15" transform="translate(1098.28125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1137.296875 0)"/>
|
<use xlink:href="#DejaVuSans-c" transform="translate(1161.90625 0)"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g id="text_4">
|
<g id="text_4">
|
||||||
<!-- ua-parser (Rust) 21 000 -->
|
<!-- 26 000 ua-parser (Rust) -->
|
||||||
<g style="fill: #767676" transform="translate(163.650472 56.474791) scale(0.11 -0.11)">
|
<g style="fill: #767676" transform="translate(325.821657 31.604393) scale(0.11 -0.11)">
|
||||||
<use xlink:href="#DejaVuSans-58"/>
|
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(63.375 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-10" transform="translate(124.65625 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-53" transform="translate(160.734375 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(224.21875 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(285.5 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(326.609375 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(378.703125 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(440.234375 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(481.34375 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-b" transform="translate(513.125 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-35" transform="translate(552.140625 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-58" transform="translate(617.140625 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(680.515625 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-57" transform="translate(732.609375 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-c" transform="translate(771.8125 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(810.828125 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(842.609375 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-15" transform="translate(874.390625 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-14" transform="translate(938.015625 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-62" transform="translate(1001.640625 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1033.421875 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1097.046875 0)"/>
|
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1160.671875 0)"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g id="text_5">
|
|
||||||
<!-- uarite 56 000 -->
|
|
||||||
<g style="fill: #ffffff" transform="translate(312.245579 37.981001) scale(0.11 -0.11)">
|
|
||||||
<defs>
|
<defs>
|
||||||
<path id="DejaVuSans-4c" d="M 603 3500
|
|
||||||
L 1178 3500
|
|
||||||
L 1178 0
|
|
||||||
L 603 0
|
|
||||||
L 603 3500
|
|
||||||
z
|
|
||||||
M 603 4863
|
|
||||||
L 1178 4863
|
|
||||||
L 1178 4134
|
|
||||||
L 603 4134
|
|
||||||
L 603 4863
|
|
||||||
z
|
|
||||||
" transform="scale(0.015625)"/>
|
|
||||||
<path id="DejaVuSans-18" d="M 691 4666
|
|
||||||
L 3169 4666
|
|
||||||
L 3169 4134
|
|
||||||
L 1269 4134
|
|
||||||
L 1269 2991
|
|
||||||
Q 1406 3038 1543 3061
|
|
||||||
Q 1681 3084 1819 3084
|
|
||||||
Q 2600 3084 3056 2656
|
|
||||||
Q 3513 2228 3513 1497
|
|
||||||
Q 3513 744 3044 326
|
|
||||||
Q 2575 -91 1722 -91
|
|
||||||
Q 1428 -91 1123 -41
|
|
||||||
Q 819 9 494 109
|
|
||||||
L 494 744
|
|
||||||
Q 775 591 1075 516
|
|
||||||
Q 1375 441 1709 441
|
|
||||||
Q 2250 441 2565 725
|
|
||||||
Q 2881 1009 2881 1497
|
|
||||||
Q 2881 1984 2565 2268
|
|
||||||
Q 2250 2553 1709 2553
|
|
||||||
Q 1456 2553 1204 2497
|
|
||||||
Q 953 2441 691 2322
|
|
||||||
L 691 4666
|
|
||||||
z
|
|
||||||
" transform="scale(0.015625)"/>
|
|
||||||
<path id="DejaVuSans-19" d="M 2113 2584
|
<path id="DejaVuSans-19" d="M 2113 2584
|
||||||
Q 1688 2584 1439 2293
|
Q 1688 2584 1439 2293
|
||||||
Q 1191 2003 1191 1497
|
Q 1191 2003 1191 1497
|
||||||
@@ -655,58 +599,96 @@ Q 3103 4656 3366 4563
|
|||||||
z
|
z
|
||||||
" transform="scale(0.015625)"/>
|
" transform="scale(0.015625)"/>
|
||||||
</defs>
|
</defs>
|
||||||
<use xlink:href="#DejaVuSans-58"/>
|
<use xlink:href="#DejaVuSans-15"/>
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(63.375 0)"/>
|
<use xlink:href="#DejaVuSans-19" transform="translate(63.625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(124.65625 0)"/>
|
<use xlink:href="#DejaVuSans-62" transform="translate(127.25 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-4c" transform="translate(165.765625 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(159.03125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-57" transform="translate(193.546875 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(222.65625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(232.75 0)"/>
|
<use xlink:href="#DejaVuSans-13" transform="translate(286.28125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(294.28125 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(349.90625 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(326.0625 0)"/>
|
<use xlink:href="#DejaVuSans-3" transform="translate(381.6875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-18" transform="translate(357.84375 0)"/>
|
<use xlink:href="#DejaVuSans-58" transform="translate(413.46875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-19" transform="translate(421.46875 0)"/>
|
<use xlink:href="#DejaVuSans-44" transform="translate(476.84375 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-62" transform="translate(485.09375 0)"/>
|
<use xlink:href="#DejaVuSans-10" transform="translate(538.125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(516.875 0)"/>
|
<use xlink:href="#DejaVuSans-53" transform="translate(574.203125 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(580.5 0)"/>
|
<use xlink:href="#DejaVuSans-44" transform="translate(637.6875 0)"/>
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(644.125 0)"/>
|
<use xlink:href="#DejaVuSans-55" transform="translate(698.96875 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-56" transform="translate(740.078125 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-48" transform="translate(792.171875 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-55" transform="translate(853.703125 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-3" transform="translate(894.8125 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-b" transform="translate(926.59375 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-35" transform="translate(965.609375 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-58" transform="translate(1030.609375 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-56" transform="translate(1093.984375 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-57" transform="translate(1146.078125 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-c" transform="translate(1185.28125 0)"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<g id="text_6">
|
<g id="text_5">
|
||||||
<!-- user-agent-parser 120 000 -->
|
<!-- 56 000 uarite -->
|
||||||
<g style="fill: #ffffff" transform="translate(700.930156 19.48635) scale(0.11 -0.11)">
|
<g style="fill: #767676" transform="translate(679.0752 15.920175) scale(0.11 -0.11)">
|
||||||
<use xlink:href="#DejaVuSans-58"/>
|
<defs>
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(63.375 0)"/>
|
<path id="DejaVuSans-18" d="M 691 4666
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(115.46875 0)"/>
|
L 3169 4666
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(177 0)"/>
|
L 3169 4134
|
||||||
<use xlink:href="#DejaVuSans-10" transform="translate(211.71875 0)"/>
|
L 1269 4134
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(247.796875 0)"/>
|
L 1269 2991
|
||||||
<use xlink:href="#DejaVuSans-4a" transform="translate(309.078125 0)"/>
|
Q 1406 3038 1543 3061
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(372.5625 0)"/>
|
Q 1681 3084 1819 3084
|
||||||
<use xlink:href="#DejaVuSans-51" transform="translate(434.09375 0)"/>
|
Q 2600 3084 3056 2656
|
||||||
<use xlink:href="#DejaVuSans-57" transform="translate(497.46875 0)"/>
|
Q 3513 2228 3513 1497
|
||||||
<use xlink:href="#DejaVuSans-10" transform="translate(536.671875 0)"/>
|
Q 3513 744 3044 326
|
||||||
<use xlink:href="#DejaVuSans-53" transform="translate(572.75 0)"/>
|
Q 2575 -91 1722 -91
|
||||||
<use xlink:href="#DejaVuSans-44" transform="translate(636.234375 0)"/>
|
Q 1428 -91 1123 -41
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(697.515625 0)"/>
|
Q 819 9 494 109
|
||||||
<use xlink:href="#DejaVuSans-56" transform="translate(738.625 0)"/>
|
L 494 744
|
||||||
<use xlink:href="#DejaVuSans-48" transform="translate(790.71875 0)"/>
|
Q 775 591 1075 516
|
||||||
<use xlink:href="#DejaVuSans-55" transform="translate(852.25 0)"/>
|
Q 1375 441 1709 441
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(893.359375 0)"/>
|
Q 2250 441 2565 725
|
||||||
<use xlink:href="#DejaVuSans-3" transform="translate(925.140625 0)"/>
|
Q 2881 1009 2881 1497
|
||||||
<use xlink:href="#DejaVuSans-14" transform="translate(956.921875 0)"/>
|
Q 2881 1984 2565 2268
|
||||||
<use xlink:href="#DejaVuSans-15" transform="translate(1020.546875 0)"/>
|
Q 2250 2553 1709 2553
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1084.171875 0)"/>
|
Q 1456 2553 1204 2497
|
||||||
<use xlink:href="#DejaVuSans-62" transform="translate(1147.796875 0)"/>
|
Q 953 2441 691 2322
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1179.578125 0)"/>
|
L 691 4666
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1243.203125 0)"/>
|
z
|
||||||
<use xlink:href="#DejaVuSans-13" transform="translate(1306.828125 0)"/>
|
" transform="scale(0.015625)"/>
|
||||||
|
<path id="DejaVuSans-4c" d="M 603 3500
|
||||||
|
L 1178 3500
|
||||||
|
L 1178 0
|
||||||
|
L 603 0
|
||||||
|
L 603 3500
|
||||||
|
z
|
||||||
|
M 603 4863
|
||||||
|
L 1178 4863
|
||||||
|
L 1178 4134
|
||||||
|
L 603 4134
|
||||||
|
L 603 4863
|
||||||
|
z
|
||||||
|
" transform="scale(0.015625)"/>
|
||||||
|
</defs>
|
||||||
|
<use xlink:href="#DejaVuSans-18"/>
|
||||||
|
<use xlink:href="#DejaVuSans-19" transform="translate(63.625 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-62" transform="translate(127.25 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-13" transform="translate(159.03125 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-13" transform="translate(222.65625 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-13" transform="translate(286.28125 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-3" transform="translate(349.90625 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-3" transform="translate(381.6875 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-58" transform="translate(413.46875 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-44" transform="translate(476.84375 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-55" transform="translate(538.125 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-4c" transform="translate(579.234375 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-57" transform="translate(607.015625 0)"/>
|
||||||
|
<use xlink:href="#DejaVuSans-48" transform="translate(646.21875 0)"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
<defs>
|
<defs>
|
||||||
<clipPath id="pc2d639e53a">
|
<clipPath id="p4041b231bc">
|
||||||
<rect x="2" y="2" width="860" height="118.4"/>
|
<rect x="1.44" y="1.44" width="669.6" height="83.16"/>
|
||||||
</clipPath>
|
</clipPath>
|
||||||
</defs>
|
</defs>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 19 KiB |
+2
-2
@@ -17,7 +17,7 @@ benchmark-only dependencies, pulled ad hoc via `uv run --with`.
|
|||||||
- `prettytable.py` — prints the accuracy-comparison markdown table:
|
- `prettytable.py` — prints the accuracy-comparison markdown table:
|
||||||
|
|
||||||
```
|
```
|
||||||
uv run --with ua-parser --with user-agents python scripts/prettytable.py
|
uv run --with ua-parser --with fastuaparser python scripts/prettytable.py
|
||||||
```
|
```
|
||||||
|
|
||||||
- `bench.py` — prints browser-accuracy counts, crawler-detection rates,
|
- `bench.py` — prints browser-accuracy counts, crawler-detection rates,
|
||||||
@@ -25,6 +25,6 @@ benchmark-only dependencies, pulled ad hoc via `uv run --with`.
|
|||||||
mix, bot storm) with cache statistics:
|
mix, bot storm) with cache statistics:
|
||||||
|
|
||||||
```
|
```
|
||||||
uv run --with ua-parser --with user-agents --with user-agent-parser \
|
uv run --with ua-parser --with user-agents --with fastuaparser \
|
||||||
python scripts/bench.py
|
python scripts/bench.py
|
||||||
```
|
```
|
||||||
|
|||||||
+43
-23
@@ -1,16 +1,16 @@
|
|||||||
# /// script
|
# /// script
|
||||||
# requires-python = ">=3.14"
|
# requires-python = ">=3.14"
|
||||||
# dependencies = [
|
# dependencies = [
|
||||||
|
# "fastuaparser>=0.1.4",
|
||||||
# "ua-parser[re2,regex]>=1.0.2",
|
# "ua-parser[re2,regex]>=1.0.2",
|
||||||
# "uarite",
|
# "uarite",
|
||||||
# "user-agent-parser>=0.2.1",
|
|
||||||
# "user-agents>=2.2.0",
|
# "user-agents>=2.2.0",
|
||||||
# ]
|
# ]
|
||||||
#
|
#
|
||||||
# [tool.uv.sources]
|
# [tool.uv.sources]
|
||||||
# uarite = { path = "..", editable = true }
|
# uarite = { path = "..", editable = true }
|
||||||
# ///
|
# ///
|
||||||
"""Benchmark uarite vs ua-parser vs user-agents vs user-agent-parser.
|
"""Benchmark uarite vs ua-parser vs user-agents vs fastuaparser.
|
||||||
|
|
||||||
Reproduces the README's numbers: browser accuracy on 100 modern UAs,
|
Reproduces the README's numbers: browser accuracy on 100 modern UAs,
|
||||||
crawler detection on 2163 real-world crawler UAs, and timing (unique UAs,
|
crawler detection on 2163 real-world crawler UAs, and timing (unique UAs,
|
||||||
@@ -29,8 +29,8 @@ import timeit
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import ua_parser
|
import ua_parser
|
||||||
|
from fastuaparser import parse_ua as fua_parse
|
||||||
from ua_parser import parse as ua_parse
|
from ua_parser import parse as ua_parse
|
||||||
from user_agent_parser import parse as uap_parse
|
|
||||||
from user_agents import parse as uas_parse
|
from user_agents import parse as uas_parse
|
||||||
|
|
||||||
from uarite import uaparse
|
from uarite import uaparse
|
||||||
@@ -74,6 +74,7 @@ def uap_re2(ua):
|
|||||||
def uap_rust(ua):
|
def uap_rust(ua):
|
||||||
return ua_variant("rust")(ua)
|
return ua_variant("rust")(ua)
|
||||||
|
|
||||||
|
|
||||||
DATA = Path(__file__).parent / "data"
|
DATA = Path(__file__).parent / "data"
|
||||||
BROWSERS = json.loads((DATA / "top-user-agents.json").read_text())
|
BROWSERS = json.loads((DATA / "top-user-agents.json").read_text())
|
||||||
CRAWLERS = json.loads((DATA / "crawler-user-agents.json").read_text())
|
CRAWLERS = json.loads((DATA / "crawler-user-agents.json").read_text())
|
||||||
@@ -125,7 +126,6 @@ def score_browsers():
|
|||||||
for name, fn in (
|
for name, fn in (
|
||||||
("ua-parser", ua_parse),
|
("ua-parser", ua_parse),
|
||||||
("user-agents", uas_parse),
|
("user-agents", uas_parse),
|
||||||
("user-agent-parser", uap_parse),
|
|
||||||
):
|
):
|
||||||
fam_ok = ver_ok = os_ok = 0
|
fam_ok = ver_ok = os_ok = 0
|
||||||
for ua in BROWSERS:
|
for ua in BROWSERS:
|
||||||
@@ -135,10 +135,6 @@ def score_browsers():
|
|||||||
fam = r.user_agent.family or ""
|
fam = r.user_agent.family or ""
|
||||||
maj = r.user_agent.major or ""
|
maj = r.user_agent.major or ""
|
||||||
osf = r.os.family or ""
|
osf = r.os.family or ""
|
||||||
elif name == "user-agent-parser":
|
|
||||||
fam = r[0] or ""
|
|
||||||
maj = (r[1] or "").split(".")[0]
|
|
||||||
osf = r[2] or ""
|
|
||||||
else:
|
else:
|
||||||
fam = r.browser.family or ""
|
fam = r.browser.family or ""
|
||||||
maj = str(r.browser.version[0]) if r.browser.version else ""
|
maj = str(r.browser.version[0]) if r.browser.version else ""
|
||||||
@@ -148,6 +144,29 @@ def score_browsers():
|
|||||||
ver_ok += emaj == maj
|
ver_ok += emaj == maj
|
||||||
os_ok += eos == norm_os(osf)
|
os_ok += eos == norm_os(osf)
|
||||||
res[name] = (fam_ok, ver_ok, os_ok)
|
res[name] = (fam_ok, ver_ok, os_ok)
|
||||||
|
# fastuaparser returns one pretty string ("Chrome - Windows") and no
|
||||||
|
# version numbers, so score it on the substrings it does produce.
|
||||||
|
fam_ok = ver_ok = os_ok = 0
|
||||||
|
for ua in BROWSERS:
|
||||||
|
efam, emaj, eos = expected(ua)
|
||||||
|
pretty = fua_parse(ua)
|
||||||
|
fam_ok += efam.split()[0].lower() in pretty.lower()
|
||||||
|
ver_ok += bool(emaj) and emaj in pretty
|
||||||
|
os_ok += bool(
|
||||||
|
re.search(
|
||||||
|
{
|
||||||
|
"ios": r"iOS|iPhone|iPad",
|
||||||
|
"macos": r"Mac",
|
||||||
|
"windows": r"Windows",
|
||||||
|
"linux": r"Linux",
|
||||||
|
"android": r"Android",
|
||||||
|
}[eos],
|
||||||
|
pretty,
|
||||||
|
)
|
||||||
|
if eos
|
||||||
|
else True
|
||||||
|
)
|
||||||
|
res["fastuaparser"] = (fam_ok, ver_ok, os_ok)
|
||||||
fam_ok = ver_ok = os_ok = 0
|
fam_ok = ver_ok = os_ok = 0
|
||||||
for ua in BROWSERS:
|
for ua in BROWSERS:
|
||||||
efam, emaj, eos = expected(ua)
|
efam, emaj, eos = expected(ua)
|
||||||
@@ -183,7 +202,7 @@ def score_browsers():
|
|||||||
def score_crawlers():
|
def score_crawlers():
|
||||||
out = {}
|
out = {}
|
||||||
crashes = 0
|
crashes = 0
|
||||||
for name in ("ua-parser", "user-agents", "user-agent-parser", "uarite"):
|
for name in ("ua-parser", "user-agents", "fastuaparser", "uarite"):
|
||||||
det = 0
|
det = 0
|
||||||
for ua in CRAWLER_UAS:
|
for ua in CRAWLER_UAS:
|
||||||
try:
|
try:
|
||||||
@@ -195,14 +214,16 @@ def score_crawlers():
|
|||||||
)
|
)
|
||||||
elif name == "user-agents":
|
elif name == "user-agents":
|
||||||
bot = uas_parse(ua).is_bot
|
bot = uas_parse(ua).is_bot
|
||||||
elif name == "user-agent-parser":
|
elif name == "fastuaparser":
|
||||||
bot = uap_parse(ua)[4] == "Bot"
|
# "Bot" is a real verdict; "Other" is a non-browser
|
||||||
|
# client (wget etc.), which is automated traffic too.
|
||||||
|
bot = fua_parse(ua).split(" - ")[0] in ("Bot", "Other")
|
||||||
else:
|
else:
|
||||||
# Anything not recognized as a real browser is automated:
|
# Anything not recognized as a real browser is automated:
|
||||||
# known bots, generic spiders, clients, spoofed claims.
|
# known bots, generic spiders, clients, spoofed claims.
|
||||||
bot = uaparse(ua).kind != "browser"
|
bot = uaparse(ua).kind != "browser"
|
||||||
except Exception:
|
except Exception:
|
||||||
crashes += name == "user-agent-parser"
|
crashes += name == "fastuaparser"
|
||||||
continue
|
continue
|
||||||
det += bot
|
det += bot
|
||||||
out[name] = det
|
out[name] = det
|
||||||
@@ -248,7 +269,7 @@ def bench_realistic():
|
|||||||
("ua-parser (re2)", uap_re2),
|
("ua-parser (re2)", uap_re2),
|
||||||
("ua-parser (rust)", uap_rust),
|
("ua-parser (rust)", uap_rust),
|
||||||
("user-agents", uas_parse),
|
("user-agents", uas_parse),
|
||||||
("user-agent-parser", uap_parse),
|
("fastuaparser", fua_parse),
|
||||||
("uarite", uaparse),
|
("uarite", uaparse),
|
||||||
):
|
):
|
||||||
fn = safe(fn)
|
fn = safe(fn)
|
||||||
@@ -261,7 +282,7 @@ def bench_realistic():
|
|||||||
("ua-parser (re2)", uap_re2),
|
("ua-parser (re2)", uap_re2),
|
||||||
("ua-parser (rust)", uap_rust),
|
("ua-parser (rust)", uap_rust),
|
||||||
("user-agents", uas_parse),
|
("user-agents", uas_parse),
|
||||||
("user-agent-parser", uap_parse),
|
("fastuaparser", fua_parse),
|
||||||
("uarite", uaparse),
|
("uarite", uaparse),
|
||||||
):
|
):
|
||||||
fn = safe(fn)
|
fn = safe(fn)
|
||||||
@@ -285,11 +306,8 @@ def cache_info(name):
|
|||||||
if name == "uarite":
|
if name == "uarite":
|
||||||
i = uaparse.cache_info()
|
i = uaparse.cache_info()
|
||||||
return f"{i.hits} hits / {i.misses} misses (cap 1024)"
|
return f"{i.hits} hits / {i.misses} misses (cap 1024)"
|
||||||
if name == "user-agent-parser":
|
if name == "fastuaparser":
|
||||||
from user_agent_parser.parser import _cached_parse_user_agent
|
return "none (branch parser, ~1 µs flat)"
|
||||||
|
|
||||||
i = _cached_parse_user_agent.cache_info()
|
|
||||||
return f"{i.hits} hits / {i.misses} misses (cap 512 LRU)"
|
|
||||||
if name == "user-agents":
|
if name == "user-agents":
|
||||||
from ua_parser.user_agent_parser import _PARSE_CACHE
|
from ua_parser.user_agent_parser import _PARSE_CACHE
|
||||||
|
|
||||||
@@ -318,7 +336,7 @@ def bench():
|
|||||||
("ua-parser (re2)", uap_re2),
|
("ua-parser (re2)", uap_re2),
|
||||||
("ua-parser (rust)", uap_rust),
|
("ua-parser (rust)", uap_rust),
|
||||||
("user-agents", uas_parse),
|
("user-agents", uas_parse),
|
||||||
("user-agent-parser", uap_parse),
|
("fastuaparser", fua_parse),
|
||||||
("uarite", uaparse),
|
("uarite", uaparse),
|
||||||
):
|
):
|
||||||
fn = safe(fn)
|
fn = safe(fn)
|
||||||
@@ -331,8 +349,10 @@ def bench():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
res, nwork = bench()
|
res, nwork = bench()
|
||||||
print(f"## speed (µs per cold parse, {nwork} unique UAs,"
|
print(
|
||||||
" half browsers / half crawlers)")
|
f"## speed (µs per cold parse, {nwork} unique UAs,"
|
||||||
|
" half browsers / half crawlers)"
|
||||||
|
)
|
||||||
for k, v in res.items():
|
for k, v in res.items():
|
||||||
print(f"{k:20} {v:8.1f}")
|
print(f"{k:20} {v:8.1f}")
|
||||||
print(f"\n## browser accuracy (n={len(BROWSERS)}): family / version / OS correct")
|
print(f"\n## browser accuracy (n={len(BROWSERS)}): family / version / OS correct")
|
||||||
@@ -342,6 +362,6 @@ if __name__ == "__main__":
|
|||||||
print(f"\n## crawler detection (n={len(CRAWLER_UAS)})")
|
print(f"\n## crawler detection (n={len(CRAWLER_UAS)})")
|
||||||
for k, v in det.items():
|
for k, v in det.items():
|
||||||
print(f"{k:18} {v:5} ({v / len(CRAWLER_UAS):.1%})")
|
print(f"{k:18} {v:5} ({v / len(CRAWLER_UAS):.1%})")
|
||||||
print(f"user-agent-parser crashed on {crashes} UAs")
|
print(f"fastuaparser crashed on {crashes} UAs")
|
||||||
print(f"\nuarite URL extraction: {url_got}/{url_have} of instances carrying a URL")
|
print(f"\nuarite URL extraction: {url_got}/{url_have} of instances carrying a URL")
|
||||||
bench_realistic()
|
bench_realistic()
|
||||||
|
|||||||
+8
-15
@@ -1,15 +1,15 @@
|
|||||||
"""Print the README's accuracy-comparison table as markdown.
|
"""Print the README's accuracy-comparison table as markdown.
|
||||||
|
|
||||||
uarite's column is simply `r.pretty`. The reference modules have no
|
uarite's and fastuaparser's columns are simply their pretty-string output.
|
||||||
display format; their columns use one plain format string each on their
|
ua-parser has no display format; its column uses one plain format string
|
||||||
structured output (footnotes ²³ in the README). Requires uarite (installed)
|
on the structured output (footnotes ¹² in the README). Requires uarite
|
||||||
plus the benchmark-only reference parsers:
|
(installed) plus the benchmark-only reference parsers:
|
||||||
|
|
||||||
uv run --with ua-parser --with user-agents python scripts/prettytable.py
|
uv run --with ua-parser --with fastuaparser python scripts/prettytable.py
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from fastuaparser import parse_ua as fua_parse
|
||||||
from ua_parser import parse as ua_parse
|
from ua_parser import parse as ua_parse
|
||||||
from user_agents import parse as uas_parse
|
|
||||||
|
|
||||||
from uarite import uaparse
|
from uarite import uaparse
|
||||||
|
|
||||||
@@ -86,15 +86,8 @@ def imitate_uaparser(ua):
|
|||||||
return f"{fam}/{maj} {osf} {dev}"
|
return f"{fam}/{maj} {osf} {dev}"
|
||||||
|
|
||||||
|
|
||||||
def imitate_useragents(ua):
|
print("| Case | uarite¹ | fastuaparser² | ua-parser³ |")
|
||||||
r = uas_parse(ua)
|
|
||||||
fam = r.browser.family or ""
|
|
||||||
maj = str(r.browser.version[0]) if r.browser.version else ""
|
|
||||||
return f"{fam}/{maj} {r.os.family or ''} {r.device.family or ''}"
|
|
||||||
|
|
||||||
|
|
||||||
print("| Case | uarite¹ | ua-parser² | user-agents³ |")
|
|
||||||
print("|---|---|---|---|")
|
print("|---|---|---|---|")
|
||||||
for name, ua in CASES:
|
for name, ua in CASES:
|
||||||
ours = uaparse(ua).pretty or "—"
|
ours = uaparse(ua).pretty or "—"
|
||||||
print(f"| {name} | {ours} | {imitate_uaparser(ua)} | {imitate_useragents(ua)} |")
|
print(f"| {name} | {ours} | {fua_parse(ua)} | {imitate_uaparser(ua)} |")
|
||||||
|
|||||||
+17
-19
@@ -23,13 +23,14 @@ matplotlib.rcParams["svg.fonttype"] = "path" # text as paths: renders anywhere
|
|||||||
import matplotlib.pyplot as plt # noqa: E402
|
import matplotlib.pyplot as plt # noqa: E402
|
||||||
|
|
||||||
# µs per cold parse, from scripts/bench.py.
|
# µs per cold parse, from scripts/bench.py.
|
||||||
|
# fastuaparser (~1 µs, 1M parses/s) and cached results are too far off
|
||||||
|
# this scale to draw meaningfully and are only mentioned in the README.
|
||||||
US = {
|
US = {
|
||||||
"user-agent-parser": 8.2,
|
"uarite": 18.0,
|
||||||
"uarite": 17.7,
|
"ua-parser (Rust)": 38.1,
|
||||||
"ua-parser (Rust)": 46.6,
|
"ua-parser (RE2)": 71.7,
|
||||||
"ua-parser (RE2)": 77.1,
|
"ua-parser": 304.7,
|
||||||
"ua-parser": 321.5,
|
"user-agents": 324.6,
|
||||||
"user-agents": 334.4,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#: Readable on both white and dark backgrounds.
|
#: Readable on both white and dark backgrounds.
|
||||||
@@ -41,29 +42,26 @@ values = [v for _, v in data][::-1]
|
|||||||
colors = ["#6e6e6e"] * len(data)
|
colors = ["#6e6e6e"] * len(data)
|
||||||
colors[names.index("uarite")] = "#2b6cb0"
|
colors[names.index("uarite")] = "#2b6cb0"
|
||||||
|
|
||||||
fig, ax = plt.subplots(figsize=(12, 1.7), dpi=100)
|
fig, ax = plt.subplots(figsize=(12, 1.5), dpi=100)
|
||||||
bars = ax.barh(names, values, color=colors, height=0.82)
|
bars = ax.barh(names, values, color=colors, height=0.82)
|
||||||
ax.set_xlim(0, max(values))
|
xmax = max(values)
|
||||||
|
ax.set_xlim(0, xmax)
|
||||||
ax.axis("off")
|
ax.axis("off")
|
||||||
|
|
||||||
for bar, name, v in zip(bars, names, values):
|
for bar, name, v in zip(bars, names, values):
|
||||||
# Round to two significant digits: 121951 -> "120 000".
|
# Round to two significant digits: 121951 -> "120 000".
|
||||||
rounded = round(v, 1 - int(f"{v:.0e}".split("e")[1]))
|
rounded = round(v, 1 - int(f"{v:.0e}".split("e")[1]))
|
||||||
label = f"{name} {rounded:,.0f}".replace(",", " ")
|
label = f"{rounded:,.0f} {name}".replace(",", " ")
|
||||||
# va="center" centers the font bbox incl. descender space, which leaves
|
# va="center" centers the font bbox incl. descender space, which leaves
|
||||||
# the glyphs slightly high; nudge down to optically center on the bar.
|
# the glyphs slightly high; nudge down to optically center on the bar.
|
||||||
y = bar.get_y() + bar.get_height() / 2 - 0.09
|
y = bar.get_y() + bar.get_height() / 2 - 0.09
|
||||||
if bar.get_width() > max(values) * 0.28:
|
# All labels after the bar: theme-neutral gray, number before name.
|
||||||
# Long bar: white text inside, right-aligned at the bar end.
|
# The longest bar's label overflows the axes; bbox_inches="tight"
|
||||||
ax.text(bar.get_width() - max(values) * 0.012, y, label,
|
# below expands the canvas to include it, so no dead space remains.
|
||||||
va="center", ha="right", color="white", fontsize=11)
|
ax.text(bar.get_width() + xmax * 0.012, y, label,
|
||||||
else:
|
va="center", color=OUTSIDE, fontsize=11)
|
||||||
# Short bar: theme-neutral gray text just past the bar end.
|
|
||||||
ax.text(bar.get_width() + max(values) * 0.012, y, label,
|
|
||||||
va="center", color=OUTSIDE, fontsize=11)
|
|
||||||
|
|
||||||
fig.tight_layout(pad=0.2)
|
|
||||||
out = Path("docs/bench-speed.svg")
|
out = Path("docs/bench-speed.svg")
|
||||||
out.parent.mkdir(exist_ok=True)
|
out.parent.mkdir(exist_ok=True)
|
||||||
fig.savefig(out, transparent=True)
|
fig.savefig(out, transparent=True, bbox_inches="tight", pad_inches=0.02)
|
||||||
print("wrote", out)
|
print("wrote", out)
|
||||||
|
|||||||
Reference in New Issue
Block a user