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

Faster custom losses #197

Merged
merged 2 commits into from
Apr 24, 2023
Merged

Faster custom losses #197

merged 2 commits into from
Apr 24, 2023

Conversation

MilesCranmer
Copy link
Owner

This makes custom losses faster by changing

sum(loss.(x, y))

into

l(i) = loss(x[i], y[i])
sum(l, eachindex(x))

It's a small change but improves the speed of custom losses quite a bit (because sum(::Function, ...) performs the sum with a map reduce)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 24, 2023

Benchmark Results

master 9418230... t[master]/t[9418230...]
search/multithreading 54.7 ± 2.4 s 52.6 ± 1.5 s 1.04
search/serial 59.2 ± 0.91 s 58 ± 0.86 s 1.02
time_to_load 16.8 ± 0.083 s 17 ± 0.17 s 0.993

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@MilesCranmer MilesCranmer merged commit 61ecbed into master Apr 24, 2023
16 checks passed
@MilesCranmer MilesCranmer deleted the faster-custom-losses branch April 24, 2023 15:39
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.

None yet

1 participant