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

implement speedups with rust v2 #438

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

Conversation

carsonburr
Copy link
Contributor

pip install -e . in a virtualenv should build src/markupsafe/_rust_speedups.???.so, assuming you have Rust installed.

python bench.py to run all benchmarks, rust included. Here's the results on my machine:

$ python bench.py

short escape native: Mean +- std dev: 656 ns +- 12 ns
short escape speedups: Mean +- std dev: 417 ns +- 7 ns
short escape rust_speedups: Mean +- std dev: 522 ns +- 15 ns

long escape native: Mean +- std dev: 17.3 us +- 0.2 us
long escape speedups: Mean +- std dev: 7.79 us +- 0.14 us
long escape rust_speedups: Mean +- std dev: 6.71 us +- 0.08 us

short plain native: Mean +- std dev: 505 ns +- 9 ns
short plain speedups: Mean +- std dev: 349 ns +- 5 ns
short plain rust_speedups: Mean +- std dev: 401 ns +- 4 ns

long plain native: Mean +- std dev: 17.2 us +- 0.1 us
long plain speedups: Mean +- std dev: 7.77 us +- 0.10 us
long plain rust_speedups: Mean +- std dev: 6.73 us +- 0.15 us

long suffix native: Mean +- std dev: 134 us +- 1 us
long suffix speedups: Mean +- std dev: 131 us +- 1 us
long suffix rust_speedups: Mean +- std dev: 58.3 us +- 1.2 us

@davidism
Copy link
Member

davidism commented Apr 23, 2024

I'll have to run it on my machine for an exact comparison, but those are some good performance numbers compared to the C for the long benchmarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants