Skip to content

Commit 17b12a0

Browse files
KDr2KDr2
authored andcommitted
Benchmarks on task and TArray copying
1 parent 897009f commit 17b12a0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/benchmarks.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,23 @@ print("set indexing: ")
3434
@btime setindexing($TA, $x, $y)
3535
print("broadcast: ")
3636
@btime broadcasting($TA)
37+
38+
print("= Benchmarks on task and TArray copying")
39+
function f()
40+
t = TArray(Int, 1)
41+
t[1] = 0
42+
while true
43+
produce(t[1])
44+
t[1]
45+
t[1] = 1 + t[1]
46+
end
47+
end
48+
49+
@btime begin
50+
ctask = CTask(f)
51+
consume(ctask)
52+
consume(ctask)
53+
a = copy(ctask)
54+
consume(a)
55+
consume(a)
56+
end

0 commit comments

Comments
 (0)