From 9354d7efbceb2469efe1ae1eab12c93db37be4bd Mon Sep 17 00:00:00 2001 From: KDr2 Date: Wed, 16 Jun 2021 08:04:16 +0000 Subject: [PATCH] Benchmarks on task and TArray copying --- test/benchmarks.jl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/benchmarks.jl b/test/benchmarks.jl index 25327808..f71b271a 100644 --- a/test/benchmarks.jl +++ b/test/benchmarks.jl @@ -34,3 +34,23 @@ print("set indexing: ") @btime setindexing($TA, $x, $y) print("broadcast: ") @btime broadcasting($TA) + +print("= Benchmarks on task and TArray copying") +function f() + t = TArray(Int, 1) + t[1] = 0 + while true + produce(t[1]) + t[1] + t[1] = 1 + t[1] + end +end + +@btime begin + ctask = CTask(f) + consume(ctask) + consume(ctask) + a = copy(ctask) + consume(a) + consume(a) +end