Skip to content

perf: optimize cast_locale function #552

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

Merged
merged 1 commit into from
Oct 19, 2021
Merged

perf: optimize cast_locale function #552

merged 1 commit into from
Oct 19, 2021

Conversation

tvuotila
Copy link
Collaborator

3x performance boost

get_args_count function is quite slow on Python 3.9.7.

Here are my performance tests:

  non-callable locale 0 argument locale 1 argument locale 2 argument locale
before 1.42 µs ± 82 ns 25.7 µs ± 380 ns 36.6 µs ± 1780 ns 43.7 µs ± 1250 ns
after 1.33 µs ± 93.5 ns 8.9 µs ± 241 ns 5.47 µs ± 286 ns 1.56 µs ± 20.6 ns

@tvuotila tvuotila requested a review from kvesteri October 19, 2021 07:30
@kvesteri kvesteri merged commit b88d22e into kvesteri:master Oct 19, 2021
@tvuotila tvuotila deleted the perf/improve-cast-locale-performance branch October 19, 2021 08:32
StdCarrot pushed a commit to StdCarrot/sqlalchemy-utils that referenced this pull request Apr 14, 2022
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