Skip to content

Conversation

@graalvmbot
Copy link
Collaborator

@graalvmbot graalvmbot commented Jan 14, 2026

This PR changes math.frexp() to use a more efficient implementation (which is used in test_math.py to calculate fsum() in pure Python). The speedup on a microbenchmark is significant:

# Before
$ graalpy bench_frexp.py
Frexp of 100 numbers: 0.032746 seconds
Frexp of 1000 numbers: 0.020959 seconds
Frexp of 10000 numbers: 0.114700 seconds
Frexp of 100000 numbers: 1.068651 seconds
Frexp of 1000000 numbers: 11.591474 seconds

# After
$ graalpy bench_frexp.py
Frexp of 100 numbers: 0.024994 seconds
Frexp of 1000 numbers: 0.005753 seconds
Frexp of 10000 numbers: 0.012655 seconds
Frexp of 100000 numbers: 0.164891 seconds
Frexp of 1000000 numbers: 2.091557 seconds

# CPython
$ python3.11 bench_frexp.py 
Frexp of 100 numbers: 0.000389 seconds
Frexp of 1000 numbers: 0.004296 seconds
Frexp of 10000 numbers: 0.048125 seconds
Frexp of 100000 numbers: 0.546065 seconds
Frexp of 1000000 numbers: 5.815804 seconds

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 14, 2026
@graalvmbot graalvmbot closed this Jan 14, 2026
@graalvmbot graalvmbot deleted the fniephaus/GR-60145/frexp branch January 14, 2026 14:38
@graalvmbot graalvmbot merged commit cae4d1e into master Jan 14, 2026
52 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants