Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance(stdlib): Switch to much faster ua-parser #1317

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JakubOnderka
Copy link
Contributor

@JakubOnderka JakubOnderka commented Mar 4, 2025

Summary

ua-parser crate is 55 times faster than uaparser and also allows to avoid dependency on serde_yaml (that reduces compiled binary size by 200 kb).

Benchmark

vrl_stdlib/functions/parse_user_agent/fast:

  • 16.481 µs (for comparison, this test do not use ua-parser)

vrl_stdlib/functions/parse_user_agent/enriched:

  • before: 1.7729 ms (uaparser)
  • after: 0.03228 ms (ua-parser, 55 times faster)

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

cargo test with more tests added.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on
    our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Our CONTRIBUTING.md is a good starting place.
  • If this PR introduces changes to LICENSE-3rdparty.csv, please
    run dd-rust-license-tool write and commit the changes. More details here.
  • For new VRL functions, please also create a sibling PR in Vector to document the new function.

@JakubOnderka JakubOnderka force-pushed the ua-parser branch 2 times, most recently from 8dc55d5 to 3d0fe2a Compare March 5, 2025 08:50
@JakubOnderka JakubOnderka marked this pull request as ready for review March 5, 2025 08:50
@JakubOnderka JakubOnderka force-pushed the ua-parser branch 2 times, most recently from 22b3223 to e1bb570 Compare March 5, 2025 09:07
@pront
Copy link
Member

pront commented Mar 5, 2025

Hi @JakubOnderka, how do these creates https://crates.io/crates/ua-parser vs https://crates.io/crates/uaparser compare in terms of maturity?

@JakubOnderka
Copy link
Contributor Author

JakubOnderka commented Mar 5, 2025

Hi @JakubOnderka, how do these creates https://crates.io/crates/ua-parser vs https://crates.io/crates/uaparser compare in terms of maturity?

I checked code and it looks good for me. ua-parser is part of https://github.com/ua-parser/ group and it also default backend for Pythons ua-parser package that is downloaded 7 milion times every month.

@pront pront self-assigned this Mar 5, 2025
@pront pront added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Mar 5, 2025
@pront
Copy link
Member

pront commented Mar 24, 2025

Hi @JakubOnderka, how do these creates https://crates.io/crates/ua-parser vs https://crates.io/crates/uaparser compare in terms of maturity?

I checked code and it looks good for me. ua-parser is part of https://github.com/ua-parser/ group and it also default backend for Pythons ua-parser package that is downloaded 7 milion times every month.

Thank you @JakubOnderka, can you add a changelog? Then I believe we can merge this.

@pront pront added meta: awaiting author Pull requests that are awaiting their author. and removed no-changelog Changes in this PR do not need user-facing explanations in the release changelog labels Mar 24, 2025
@JakubOnderka
Copy link
Contributor Author

Changelog added.

@pront pront enabled auto-merge March 27, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta: awaiting author Pull requests that are awaiting their author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants