JuliaInterop / ObjectiveC.jl

Objective-C embedded in Julia
Other
39 stars 10 forks source link

Make NSAutoreleasePool an immutable struct. #30

Closed maleadt closed 7 months ago

maleadt commented 7 months ago

It's often not a good idea to call release anyway. And this improves the performance of the call, avoiding allocations:

julia> @benchmark @autoreleasepool begin end
BenchmarkTools.Trial: 10000 samples with 807 evaluations.
 Range (min … max):  153.810 ns …  1.562 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     156.651 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   167.710 ns ± 40.671 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

  █▇▅▄▁▁▁▂▁                                         ▂▂         ▁
  █████████▇▇▆█▆▆▄▃▅▄▄▄▄▃▄▄▂▃▄▄▃▄▄▃▂▄▃▃▄▄▄▂▄▃▄▃▃▄▃▄▆████▇▅▆▆▅▃ █
  154 ns        Histogram: log(frequency) by time       308 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.
codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 70.55%. Comparing base (6202c8b) to head (1826a81).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #30 +/- ## ========================================== - Coverage 72.06% 70.55% -1.51% ========================================== Files 9 9 Lines 655 652 -3 ========================================== - Hits 472 460 -12 - Misses 183 192 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.