Skip to content

Instantly share code, notes, and snippets.

@tkf
Created September 30, 2021 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkf/1ff032e31a94a4acb47d58d0fe2d6757 to your computer and use it in GitHub Desktop.
Save tkf/1ff032e31a94a4acb47d58d0fe2d6757 to your computer and use it in GitHub Desktop.
julia> Threads.nthreads()
16
julia> ENV["JULIA_EXCLUSIVE"]
"1"
julia> suite = SyncBarriersBenchmarks.BenchUniformLoops.setup();
julia> results = run(suite["dissemination"]["spin"])
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.298 ms)
"spawn" => Trial(1.589 ms)
julia> results |> DisplayAs.Unlimited
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => BenchmarkTools.Trial: 3488 samples with 1 evaluation.
Range (min … max): 1.298 ms … 12.911 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.415 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.423 ms ± 207.547 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▃▃▄▄▅▆█▆█▅▅▅▇▄▂▃▂
▁▁▁▁▁▂▂▂▃▃▄▄▅▇▇▇███████████████████▇▅▆▄▄▃▄▄▂▂▂▂▂▂▁▂▁▂▁▁▁▁▁▁ ▄
1.3 ms Histogram: frequency by time 1.57 ms <
Memory estimate: 62.09 KiB, allocs estimate: 2392.
"spawn" => BenchmarkTools.Trial: 2697 samples with 1 evaluation.
Range (min … max): 1.589 ms … 8.067 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.842 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.843 ms ± 141.046 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▁▂▄▃▄▃▅▇▇█▇▇▆█▇▆▇▅▆▅▅▅▃▃
▂▁▁▂▂▂▁▃▃▃▃▂▃▄▃▄▅▄▆▆▆▆▆██████████████████████████▇▇▆▅▃▄▃▃▃▃ ▅
1.59 ms Histogram: frequency by time 2 ms <
Memory estimate: 63.30 KiB, allocs estimate: 2408.
shell> git diff
diff --git a/src/oneway.jl b/src/oneway.jl
index 44a8e2e..ef0076e 100644
--- a/src/oneway.jl
+++ b/src/oneway.jl
@@ -33,8 +33,8 @@ function waitif(f, cond::OneWayCondition, spin::Union{Nothing,Integer})
if spin isa Integer
for _ in Base.OneTo(spin)
f() || return
- ccall(:jl_cpu_pause, Cvoid, ())
- GC.safepoint()
+ # ccall(:jl_cpu_pause, Cvoid, ())
+ # GC.safepoint()
end
end
cond.task = current_task()
julia> results = run(suite["dissemination"]["spin"])
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.405 ms)
"spawn" => Trial(2.099 ms)
julia> results |> DisplayAs.Unlimited
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => BenchmarkTools.Trial: 3107 samples with 1 evaluation.
Range (min … max): 1.405 ms … 95.839 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.559 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.607 ms ± 1.693 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▂▁▃▅▅▆▆▆█▅▂▃▄▃▁▁▁▁
▁▁▂▂▂▃▆▆▇████████████████████▇▆▇▄▆▄▄▃▃▅▃▃▂▂▃▂▂▂▂▂▂▂▁▁▁▂▁▁▂ ▄
1.41 ms Histogram: frequency by time 1.85 ms <
Memory estimate: 62.53 KiB, allocs estimate: 2406.
"spawn" => BenchmarkTools.Trial: 43 samples with 1 evaluation.
Range (min … max): 2.099 ms … 183.626 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 130.585 ms ┊ GC (median): 0.00%
Time (mean ± σ): 118.867 ms ± 36.217 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▃█
▅▁▁▁▁▅▁▁▁▁▁▅▁▇▁▁▁▁▁▁▅▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▅ ▁
2.1 ms Histogram: log(frequency) by time 184 ms <
Memory estimate: 63.86 KiB, allocs estimate: 2426.
shell> git diff
diff --git a/src/oneway.jl b/src/oneway.jl
index 44a8e2e..c2b6279 100644
--- a/src/oneway.jl
+++ b/src/oneway.jl
@@ -34,7 +34,7 @@ function waitif(f, cond::OneWayCondition, spin::Union{Nothing,Integer})
for _ in Base.OneTo(spin)
f() || return
ccall(:jl_cpu_pause, Cvoid, ())
- GC.safepoint()
+ # GC.safepoint()
end
end
cond.task = current_task()
julia> results = run(suite["dissemination"]["spin"])
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.283 ms)
"spawn" => Trial(1.603 ms)
julia> results |> DisplayAs.Unlimited
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => BenchmarkTools.Trial: 3466 samples with 1 evaluation.
Range (min … max): 1.283 ms … 96.594 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.407 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.440 ms ± 1.621 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▂▂▄▄▄▆█▅▇▃▅▅▄▃▂▂
▁▁▁▁▁▁▁▂▂▂▄▃▄▅▆▆▆█████████████████▇▇▇▆▄▄▃▄▃▃▂▂▂▂▂▂▁▁▁▁▁▁▁▁ ▄
1.28 ms Histogram: frequency by time 1.56 ms <
Memory estimate: 62.09 KiB, allocs estimate: 2392.
"spawn" => BenchmarkTools.Trial: 2714 samples with 1 evaluation.
Range (min … max): 1.603 ms … 49.487 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.819 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.840 ms ± 928.769 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▂▄▃▂▄▅▅█▅▆█▅▇▄▄▅▅▃▃▂
▁▁▁▁▁▁▂▂▂▂▃▃▃▄▅▄▅▇▇█▇█████████████████████▇▇▆▅▇▅▄▃▃▂▂▂▁▂▁▁▁ ▄
1.6 ms Histogram: frequency by time 210 ms <
Memory estimate: 63.30 KiB, allocs estimate: 2408.
shell> git diff
diff --git a/src/oneway.jl b/src/oneway.jl
index 44a8e2e..887f973 100644
--- a/src/oneway.jl
+++ b/src/oneway.jl
@@ -33,7 +33,7 @@ function waitif(f, cond::OneWayCondition, spin::Union{Nothing,Integer})
if spin isa Integer
for _ in Base.OneTo(spin)
f() || return
- ccall(:jl_cpu_pause, Cvoid, ())
+ # ccall(:jl_cpu_pause, Cvoid, ())
GC.safepoint()
end
end
julia> results = run(suite["dissemination"]["spin"])
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.293 ms)
"spawn" => Trial(1.579 ms)
julia> results |> DisplayAs.Unlimited
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => BenchmarkTools.Trial: 3374 samples with 1 evaluation.
Range (min … max): 1.293 ms … 115.722 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.442 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.479 ms ± 1.971 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▂▂▃▄▄▆▆▅▆▇█▇▆▅▅▃▃▃ ▁
▂▁▁▂▂▁▂▂▂▂▂▃▂▃▃▃▄▄▆▇▇▆██████████████████████▇▇▅▅▄▄▄▃▄▃▃▂▃▂▃ ▅
1.29 ms Histogram: frequency by time 1.56 ms <
Memory estimate: 62.31 KiB, allocs estimate: 2399.
"spawn" => BenchmarkTools.Trial: 2433 samples with 1 evaluation.
Range (min … max): 1.579 ms … 47.299 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.816 ms ┊ GC (median): 0.00%
Time (mean ± σ): 2.052 ms ± 1.089 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▃▆██▇▅▃▂▂▂▁▁ ▁ ▁
▆██████████████████▇█▇▇█▇██▇▅▆▆▇▄▆▆▅▆▇▅▆▄▅▄▅▃▄▄▄▃▆▅▃▅▅▄▄▃▃ █
1.58 ms Histogram: log(frequency) by time 4.53 ms <
Memory estimate: 63.70 KiB, allocs estimate: 2421.
shell> git diff
diff --git a/src/oneway.jl b/src/oneway.jl
index 44a8e2e..ef0076e 100644
--- a/src/oneway.jl
+++ b/src/oneway.jl
@@ -33,8 +33,8 @@ function waitif(f, cond::OneWayCondition, spin::Union{Nothing,Integer})
if spin isa Integer
for _ in Base.OneTo(spin)
f() || return
- ccall(:jl_cpu_pause, Cvoid, ())
- GC.safepoint()
+ # ccall(:jl_cpu_pause, Cvoid, ())
+ # GC.safepoint()
end
end
cond.task = current_task()
julia> results = run(suite["dissemination"]["spin"])
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.389 ms)
"spawn" => Trial(1.786 ms)
julia> results |> DisplayAs.Unlimited
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => BenchmarkTools.Trial: 3113 samples with 1 evaluation.
Range (min … max): 1.389 ms … 90.917 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.557 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.603 ms ± 1.611 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▁▁▃▅▅▆▆█▇██▇▆▅▄▂▂
▁▁▁▂▂▂▃▃▅▆███████████████████▇▇▇▇▆▅▄▄▃▃▄▃▃▂▂▂▂▂▂▂▂▁▁▁▁▂▁▁▁ ▄
1.39 ms Histogram: frequency by time 1.86 ms <
Memory estimate: 62.56 KiB, allocs estimate: 2407.
"spawn" => BenchmarkTools.Trial: 77 samples with 1 evaluation.
Range (min … max): 1.786 ms … 183.344 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 39.194 ms ┊ GC (median): 0.00%
Time (mean ± σ): 65.247 ms ± 62.405 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
█ ▅▄
█▇█▅▁▅▁▁▁▁▁▁▁▁▁▇▅▁▁▁▅▁▁▁▁▁▁▁▁▁▁▁▅▁▁▁▁▅▁▁▁▁▁▁▁▁▁▅▇▁▁▁▁▅▅███▅▅ ▁
1.79 ms Histogram: log(frequency) by time 139 ms <
Memory estimate: 63.77 KiB, allocs estimate: 2423.
julia> results = run(suite["dissemination"]["spin"])
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.382 ms)
"spawn" => Trial(10.834 ms)
julia> results |> DisplayAs.Unlimited
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => BenchmarkTools.Trial: 3103 samples with 1 evaluation.
Range (min … max): 1.382 ms … 14.207 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.579 ms ┊ GC (median): 0.00%
Time (mean ± σ): 1.609 ms ± 270.728 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
▃▃▅▅█▇▇▆▇▅▅▄▃▃▂▂
▂▁▂▂▃▃▄▄▆▆████████████████████▇▇▇▆▅▅▅▅▅▄▅▄▄▄▄▃▃▃▃▃▂▃▃▂▃▃▂▃▂ ▅
1.38 ms Histogram: frequency by time 1.94 ms <
Memory estimate: 62.53 KiB, allocs estimate: 2406.
"spawn" => BenchmarkTools.Trial: 42 samples with 1 evaluation.
Range (min … max): 10.834 ms … 142.194 ms ┊ GC (min … max): 0.00% … 0.00%
Time (median): 131.494 ms ┊ GC (median): 0.00%
Time (mean ± σ): 121.405 ms ± 26.048 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▁█
▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃▃▁▃▁▁▁▁▁▁▁▁▁▁▁▃▁▃▁▁▁▃▁▁▃▁▁▁▁▃▁▃██▅▁▁▃ ▁
10.8 ms Histogram: frequency by time 142 ms <
Memory estimate: 123.48 KiB, allocs estimate: 4334.
julia> for trial in 1:10
@show trial
display(run(suite["dissemination"]["spin"]))
end
trial = 1
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.411 ms)
"spawn" => Trial(35.138 ms)
trial = 2
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.414 ms)
"spawn" => Trial(1.878 ms)
trial = 3
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.385 ms)
"spawn" => Trial(1.997 ms)
trial = 4
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.384 ms)
"spawn" => Trial(1.807 ms)
trial = 5
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.403 ms)
"spawn" => Trial(6.381 ms)
trial = 6
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.377 ms)
"spawn" => Trial(1.848 ms)
trial = 7
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.415 ms)
"spawn" => Trial(1.954 ms)
trial = 8
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.410 ms)
"spawn" => Trial(28.070 ms)
trial = 9
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.376 ms)
"spawn" => Trial(23.498 ms)
trial = 10
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.396 ms)
"spawn" => Trial(1.881 ms)
shell> git diff
julia> for trial in 1:10
@show trial
display(run(suite["dissemination"]["spin"]))
end
trial = 1
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.291 ms)
"spawn" => Trial(1.599 ms)
trial = 2
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.298 ms)
"spawn" => Trial(1.614 ms)
trial = 3
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.211 ms)
"spawn" => Trial(1.454 ms)
trial = 4
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.218 ms)
"spawn" => Trial(1.475 ms)
trial = 5
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.214 ms)
"spawn" => Trial(1.462 ms)
trial = 6
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.250 ms)
"spawn" => Trial(1.494 ms)
trial = 7
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.225 ms)
"spawn" => Trial(1.485 ms)
trial = 8
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.228 ms)
"spawn" => Trial(1.498 ms)
trial = 9
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.236 ms)
"spawn" => Trial(1.449 ms)
trial = 10
2-element BenchmarkTools.BenchmarkGroup:
tags: []
"static" => Trial(1.345 ms)
"spawn" => Trial(1.501 ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment