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

Improve Performance for OptimizationBBO #600

Merged
merged 8 commits into from
Oct 1, 2023

Conversation

Zentrik
Copy link
Contributor

@Zentrik Zentrik commented Sep 30, 2023

This fixes a performance regression due to 92974b8. The regression is because the defaults for callback and data were changed without changing the code that branched on whether they were set to their defaults.

I removed fieldnames as that seems to not run at compile time (it was taking about 50% of the time for my use case due to having to iterate over it), probably because its effects are (!c,!e,!n,!t,!s,!m,+i)′. I believe you could fix this by using generated functions but I don't know how to.
Cthulhu complains that calling getproperty with u0 and p has an Any return type, though I don't see it in the profiler so maybe Cthulhu is wrong here? If this is an issue, I'm not sure how to fix it, perhaps this feature should be removed.

Some tests should be added to prevent this regression in the future, I've added a test to check for how many bytes are allocated.

This is so nothing breaks, if callback is called if its nothing
Not entirely sure what was going on, but we started boxing variables again I think (see SciML#519)
Currently I get 4609144 bytes allocated, whilst with `callback = (args...) -> false` I get 69929923 which should be a lower bound if the fixes in this pr were undone.
@Zentrik Zentrik marked this pull request as ready for review September 30, 2023 23:56
@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

Merging #600 (87f72a9) into master (5a4517d) will increase coverage by 0.14%.
The diff coverage is 18.18%.

@@            Coverage Diff            @@
##           master    #600      +/-   ##
=========================================
+ Coverage    8.89%   9.03%   +0.14%     
=========================================
  Files          40      40              
  Lines        2688    2690       +2     
=========================================
+ Hits          239     243       +4     
+ Misses       2449    2447       -2     
Files Coverage Δ
src/cache.jl 37.03% <100.00%> (ø)
src/utils.jl 35.55% <50.00%> (+0.67%) ⬆️
lib/OptimizationOptimisers/src/sophia.jl 0.00% <0.00%> (ø)
lib/OptimizationBBO/src/OptimizationBBO.jl 5.40% <0.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ChrisRackauckas ChrisRackauckas merged commit 7acb4d5 into SciML:master Oct 1, 2023
38 of 43 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