-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimizer: cancel finalizer registration rather than inserting `final…
…ize` This seems to perform well. ```julia mutable struct AtomicCounter @atomic count::Int end const counter = AtomicCounter(0) function withfinalizer(x) xs = finalizer(Ref(x)) do obj Base.@assume_effects :nothrow :notaskstate @atomic counter.count += obj[] end println(devnull, xs[]) xs[] = xs[] println(devnull, xs[]) return xs[] end @benchmark withfinalizer(100) ``` > master ``` BenchmarkTools.Trial: 10000 samples with 867 evaluations. Range (min … max): 135.717 ns … 18.617 μs ┊ GC (min … max): 0.00% … 47.51% Time (median): 144.992 ns ┊ GC (median): 0.00% Time (mean ± σ): 192.949 ns ± 687.513 ns ┊ GC (mean ± σ): 11.57% ± 3.23% ▇ ▃█▅▂ ▁▁▂█▇▂████▇▆▅▄▄▄▅▄▄▂▂▂▂▂▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂ 136 ns Histogram: frequency by time 201 ns < Memory estimate: 208 bytes, allocs estimate: 7. ``` > this commit ``` BenchmarkTools.Trial: 10000 samples with 964 evaluations. Range (min … max): 83.506 ns … 3.408 μs ┊ GC (min … max): 0.00% … 96.85% Time (median): 88.780 ns ┊ GC (median): 0.00% Time (mean ± σ): 101.797 ns ± 137.067 ns ┊ GC (mean ± σ): 10.26% ± 7.31% ▄█▃▅ ▄▃████▅▅▆▅▄▄▄▃▃▃▃▃▃▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▁▂▂▁▁▁▁▁▁▂▁▂▂▁▂▂ ▃ 83.5 ns Histogram: frequency by time 145 ns < Memory estimate: 208 bytes, allocs estimate: 7. ```
- Loading branch information
Showing
13 changed files
with
138 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters