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

Defer fractions.Fraction import to save 5ms #201

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Sep 9, 2024

main

image

PR

image

hyperfine

hyperfine --warmup 32 \
--prepare "git checkout defer-fractions" 'python3 -c "import humanize # PR"' \
--prepare "git checkout main"            'python3 -c "import humanize # main"'
Benchmark 1: python3 -c "import humanize # PR"
  Time (mean ± σ):      46.1 ms ±  10.7 ms    [User: 34.4 ms, System: 8.5 ms]
  Range (min … max):    39.6 ms …  95.3 ms    55 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs.

Benchmark 2: python3 -c "import humanize # main"
  Time (mean ± σ):      52.7 ms ±  16.7 ms    [User: 38.8 ms, System: 9.1 ms]
  Range (min … max):    41.7 ms … 118.4 ms    46 runs

Summary
  python3 -c "import humanize # PR" ran
    1.14 ± 0.45 times faster than python3 -c "import humanize # main"

@hugovk hugovk added the changelog: Changed For changes in existing functionality label Sep 9, 2024
@hugovk hugovk enabled auto-merge September 9, 2024 18:32
@hugovk hugovk merged commit 94fc781 into python-humanize:main Sep 9, 2024
29 checks passed
@hugovk hugovk deleted the defer-fractions branch September 9, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Changed For changes in existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant