Skip to content

Attempt to improve speed by constant factors#12

Merged
tdhock merged 9 commits intomasterfrom
opt-speed
Jul 13, 2022
Merged

Attempt to improve speed by constant factors#12
tdhock merged 9 commits intomasterfrom
opt-speed

Conversation

@tdhock
Copy link
Copy Markdown
Owner

@tdhock tdhock commented Jul 13, 2022

fixes #11

@tdhock
Copy link
Copy Markdown
Owner Author

tdhock commented Jul 13, 2022

the slowdown was due to two factors

  • returning ParamsLoss struct copy (fixed by passing pointer arg instead)
  • using unordered_map operator[ multiple times (fixed by using it once to get pointer)
    This result suggests that storing mean param as a plain struct member (not in unordered_map) may be even faster, as shown below
    figure-timings-versions

@tdhock
Copy link
Copy Markdown
Owner Author

tdhock commented Jul 13, 2022

storing parameters in class members instead of unordered_map results in significant speed improvements, but still not as good as old code which only supported square loss (no other distributions).
figure-timings-versions

@tdhock
Copy link
Copy Markdown
Owner Author

tdhock commented Jul 13, 2022

omitting variance estimation for square loss results in small speed improvements, but still not as fast as old code (cv) with plain square loss implementation (no other distributions).
figure-timings-versions

@tdhock
Copy link
Copy Markdown
Owner Author

tdhock commented Jul 13, 2022

further improvements could be obtained by omitting storage and calculation of total weighted squares cumsums and removing that term from the mean_norm loss, then adding back at the end.

@tdhock tdhock merged commit 114dbb6 into master Jul 13, 2022
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.

parameter storage constant factor speed improvements?

1 participant