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 #968

Merged
merged 2 commits into from
Jul 17, 2023
Merged

Improve performance #968

merged 2 commits into from
Jul 17, 2023

Conversation

davidanthoff
Copy link
Collaborator

There are two commits here that are unrelated.

The one about the deepcopy I'm especially not 100% sure. But I think I followed all code paths, and I think previously the deep copy that was created originally was then actually never (except for the one case where I added a deepcopy returned to user, but was essentially always a temporary copy, in which case it seems unnecessary to me.

@davidanthoff davidanthoff requested a review from lrennels July 15, 2023 07:07
@codecov
Copy link

codecov bot commented Jul 15, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (6ea9074) 84.83% compared to head (7e4b216) 84.83%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #968   +/-   ##
=======================================
  Coverage   84.83%   84.83%           
=======================================
  Files          40       40           
  Lines        4055     4055           
=======================================
  Hits         3440     3440           
  Misses        615      615           
Flag Coverage Δ
unittests 84.83% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/utils/getdataframe.jl 77.41% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@lrennels lrennels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidanthoff this seems fine to me, certainly the collect call. Looking through the use of deepcopy, my guess is that it was a safety to make sure that we don't pass around the model's data by reference, alter it in a DataFrame, and end up with a mutated model object. I think with your change this still wouldn't happen, all the uses of data (other than the one you updated on line 49) mutate the array in some way that allocates a new one, but I could see it feeling fragile.

I think for now it's fine, or we could just deepcopy the DataFrame before returning it ... or add more calls to deepcopy as guard rails but I think that probably just undoes the performance fix you made :)

@davidanthoff
Copy link
Collaborator Author

Yes, that deepcopy was the problem for performance. If you approve, I'll merge.

@lrennels lrennels self-requested a review July 17, 2023 17:55
@davidanthoff davidanthoff merged commit eb15661 into master Jul 17, 2023
@davidanthoff davidanthoff deleted the perf branch July 17, 2023 20: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.

2 participants