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

[REF] slow np.isclose to math.isclose #166

Merged
merged 1 commit into from
Oct 14, 2024
Merged

Conversation

bosd
Copy link
Collaborator

@bosd bosd commented Oct 8, 2024

Speedup as in camelot-dev#161

For reference: numpy/numpy#16160

Seems still actual in 2024. My results:

import timeit
print(timeit.timeit('np.isclose(0.5, 0, atol=1e-4)', 'import numpy as np', number=10000))
# 0.2664242945611477
print(timeit.timeit('math.isclose(0.5, 0, abs_tol=1e-4)', 'import math', number=10000))
# 0.001325499266386032

@bosd bosd added the performance Performance label Oct 8, 2024
@bosd bosd marked this pull request as ready for review October 8, 2024 17:51
@bosd bosd added the refactoring Refactoring label Oct 8, 2024
@bosd bosd merged commit 4c6720e into py-pdf:main Oct 14, 2024
12 checks passed
@bosd bosd deleted the speed-after-refactor branch October 14, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance refactoring Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant