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

Halve the number of calls to cosd, sind in spherical cellarea #794

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

asinghvi17
Copy link
Collaborator

@asinghvi17 asinghvi17 commented Oct 11, 2024

by using sincosd instead.
Using the MWE from #779 ,

Before

julia> @be Rasters.cellarea(Spherical(), ras2) seconds=30
Benchmark: 12 samples with 1 evaluation
 min    2.649 s (11115638 allocs: 1.532 GiB, 3.00% gc time)
 median 2.695 s (11115638 allocs: 1.532 GiB, 3.40% gc time)
 mean   2.706 s (11115639 allocs: 1.532 GiB, 3.84% gc time)
 max    2.763 s (11115642 allocs: 1.532 GiB, 5.76% gc time)

After

julia> @be Rasters.cellarea(Spherical(), ras2) seconds=30
Benchmark: 12 samples with 1 evaluation
 min    2.429 s (11115638 allocs: 1.532 GiB, 3.26% gc time)
 median 2.450 s (11115638 allocs: 1.532 GiB, 3.58% gc time)
 mean   2.565 s (11115648 allocs: 1.532 GiB, 3.89% gc time, <0.01% compile time)
 max    3.426 s (11115749 allocs: 1.532 GiB, 5.00% gc time, 0.08% compile time)

It's a marginal improvement but every bit counts...

@rafaqz rafaqz merged commit f5ec851 into rafaqz:main Oct 11, 2024
2 checks passed
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.

2 participants