Skip to content

perf: use IMAS.trace_simple_surfaces to improve performance#11

Open
mgyoo86 wants to merge 2 commits into
masterfrom
perf/simple_trace
Open

perf: use IMAS.trace_simple_surfaces to improve performance#11
mgyoo86 wants to merge 2 commits into
masterfrom
perf/simple_trace

Conversation

@mgyoo86

@mgyoo86 mgyoo86 commented Oct 22, 2025

Copy link
Copy Markdown
Member

Prerequisite PR

ProjectTorreyPines/IMAS.jl#282

Summary

Replace trace_surfaces with trace_simple_surfaces for flux surface calculations, significantly reducing memory overhead and runtime, thanks to @bclyons12's advice

Changes

  • Use IMAS.trace_simple_surfaces instead of IMAS.trace_surfaces
  • Add convenience dispatch method for trace_simple_surfaces on equilibrium__time_slice
  • Update type signatures to use AbstractFluxSurface for better flexibility

Performance Impact

Measured with @btime run_PAM(dd_D3D; inputs...):

Metric Before After Improvement
Runtime 9.51 ms 5.65 ms 1.7x faster
Allocations 108,287 8,167 13x fewer
Memory 7.20 MiB 2.35 MiB 3x less

Testing

  • ✅ Existing tests pass
  • ✅ Benchmark verified with D3D template case

- Replace trace_surfaces with trace_simple_surfaces
- Add convenience dispatch for trace_simple_surfaces on equilibrium__time_slice
- Update type signatures to use AbstractFluxSurface for better type flexibility

Performance improvement (measured with @Btime):
- Runtime: 8.463 ms → 5.652 ms (1.5x faster)
- Allocations: 61,925 → 7,517 (8.2x fewer)
- Memory: 6.50 MiB → 2.35 MiB (2.8x less)
@mgyoo86 mgyoo86 requested a review from avdeevag October 22, 2025 14:08
@codecov

codecov Bot commented Oct 22, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.47%. Comparing base (9ccd822) to head (0b8a21c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #11      +/-   ##
==========================================
+ Coverage   70.95%   71.47%   +0.51%     
==========================================
  Files           1        1              
  Lines         334      340       +6     
==========================================
+ Hits          237      243       +6     
  Misses         97       97              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/PAM.jl Outdated
@mgyoo86

mgyoo86 commented Oct 25, 2025

Copy link
Copy Markdown
Member Author

This PR is updated to use IMAS.jl's dispatch in the following PR, instead of the temporary one.
ProjectTorreyPines/IMAS.jl#282

@avdeevag

Copy link
Copy Markdown
Contributor

Should we merge something from IMAS here, since the tests are still failing?

@bclyons12

Copy link
Copy Markdown
Collaborator

ProjectTorreyPines/IMAS.jl#282 was merged. I'll release a new version and relaunch these tests

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.

4 participants