-
Notifications
You must be signed in to change notification settings - Fork 3
position: PSA: apply the double-angle sine formula #61
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
base: main
Are you sure you want to change the base?
Conversation
Apply the double-angle sine formula:
```
sin(2 * x) = 2 * sin(x) * cos(x)
```
The idea is:
* `sin(x)` and `sin(2 * x)` both appear as subexpressions within the
same expression
* computing `sin(x)` and `cos(x)` could conceivably be faster than
computing directly `sin(x)` and `sin(2 * x)`, because `sin(x)` and
`cos(x)` use the same polynomials in their implementations
* this relies on the compiler being smart enough
* this perhaps also relies on luck regarding things like inlining
heuristics
Benchmark Results (Julia vlts)Time benchmarks
Memory benchmarks
|
Benchmark Results (Julia vpre)Time benchmarks
Memory benchmarks
|
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 678 679 +1
=========================================
+ Hits 678 679 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
CI fails, but the failure does not seem caused by the change in this PR: |
|
Yes I see, that's because I also see more allocations on version 1.12.4. I have seen that in other places (outside SolarPosition.jl) as well, I will investigate what's causing that. |
|
If you sync your branch the checks should pass now. |
Apply the double-angle sine formula:
The idea is:
sin(x)andsin(2 * x)both appear as subexpressions within the same expressioncomputing
sin(x)andcos(x)could conceivably be faster than computing directlysin(x)andsin(2 * x), becausesin(::Float64)andcos(::Float64)use the same polynomials in their implementationsthis relies on the compiler being smart enough
this perhaps also relies on luck regarding things like inlining heuristics
Checklist