AK: Improve performance of sin(), cos() and add a perf test#26674
Merged
spholz merged 3 commits intoSerenityOS:masterfrom Mar 21, 2026
Merged
AK: Improve performance of sin(), cos() and add a perf test#26674spholz merged 3 commits intoSerenityOS:masterfrom
spholz merged 3 commits intoSerenityOS:masterfrom
Conversation
On my system, with macOS system libm: Running benchmark 'bench_trig_cos'. Completed benchmark 'bench_trig_cos' in 68ms Running benchmark 'bench_trig_cosf'. Completed benchmark 'bench_trig_cosf' in 56ms Running benchmark 'bench_trig_sin'. Completed benchmark 'bench_trig_sin' in 52ms Running benchmark 'bench_trig_sinf'. Completed benchmark 'bench_trig_sinf' in 56ms With serenity libm (SerenityOS#26662): Running benchmark 'bench_trig_cos'. Completed benchmark 'bench_trig_cos' in 171ms Running benchmark 'bench_trig_cosf'. Completed benchmark 'bench_trig_cosf' in 146ms Running benchmark 'bench_trig_sin'. Completed benchmark 'bench_trig_sin' in 153ms Running benchmark 'bench_trig_sinf'. Completed benchmark 'bench_trig_sinf' in 156ms
Running benchmark 'bench_trig_cos'. Completed benchmark 'bench_trig_cos' in 132ms Running benchmark 'bench_trig_cosf'. Completed benchmark 'bench_trig_cosf' in 92ms Running benchmark 'bench_trig_sin'. Completed benchmark 'bench_trig_sin' in 112ms Running benchmark 'bench_trig_sinf'. Completed benchmark 'bench_trig_sinf' in 107ms
Running benchmark 'bench_trig_cos'. Completed benchmark 'bench_trig_cos' in 93ms Running benchmark 'bench_trig_cosf'. Completed benchmark 'bench_trig_cosf' in 64ms Running benchmark 'bench_trig_sin'. Completed benchmark 'bench_trig_sin' in 74ms Running benchmark 'bench_trig_sinf'. Completed benchmark 'bench_trig_sinf' in 65ms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before, with #26662 locally applied:
After:
For reference, with macOS libm:
No change to behavior or precision, just to runtime.