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

Optimization changes #32

Merged
merged 2 commits into from
Jan 3, 2024
Merged

Optimization changes #32

merged 2 commits into from
Jan 3, 2024

Conversation

bclyons12
Copy link
Member

These changes, and the ones in GGDUtils.jl, should be checked that they give the same results as before.

Timings for SynthDiag.compute_interferometer(ids)

  • Initial: 17.734445 seconds (52.18 M allocations: 10.914 GiB, 12.23% gc time)
  • With SynthDiag changes only: 13.543699 seconds (39.35 M allocations: 10.366 GiB, 10.35% gc time)
  • With GGDUtils changes only: 10.897210 seconds (15.08 M allocations: 1.091 GiB, 2.48% gc time)
  • With both: 8.018750 seconds (101.61 k allocations: 532.300 MiB, 1.89% gc time)

Some simple changes:

  • Remove unnecessary array allocation
  • Improve performance of _G function

Some complicated changes

  • Avoid returning multiple-dispatched function calls (just seems like a bad idea to me)
  • Simplify creation on anonymous functions
  • Use let block to avoid captured variables

Some simple:
 - Remove unnecessary array allocation
 - Improve performance of _G function

Some complicated
 - Avoid returning multiple function calls
 - Use let function to avoid captured variables (see https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-captured)
@orso82
Copy link
Member

orso82 commented Dec 8, 2023

I can feel the memory taking a sigh of relief :)

Copy link
Collaborator

@anchal-physics anchal-physics left a comment

Choose a reason for hiding this comment

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

This PR lists important places where julia code can be improved in speed by ensuring that most of the allocation of memory for arrays and function calls is happening during compilation, so that during runtime the code executes fast.

@anchal-physics anchal-physics merged commit 0e1fb60 into dev Jan 3, 2024
1 check passed
@eldond eldond deleted the optimization branch July 24, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants