File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -6,17 +6,13 @@ const dim = 1000
6
6
x = Array (Float64, 2 * dim)
7
7
y = OffsetArray (Float64, - dim + 1 : dim)
8
8
9
- fillx () = for i = 1 : 2 * dim x[i] = i end
10
- filly () = for i = - dim+ 1 : dim y[i] = i end
11
- updatex () = for i = 1 : 2 * dim x[i] = x[i] + i end
12
- updatey () = for i = - dim+ 1 : dim y[i] = y[i] + i end
13
- updatex_eachindex () = for i in eachindex (x) x[i] = x[i] + i end
14
- updatey_eachindex () = for i in eachindex (y) y[i] = y[i] + i end
15
-
16
- @benchmark fillx ()
17
- @benchmark filly ()
18
- @benchmark updatex ()
19
- @benchmark updatey ()
20
- @benchmark updatex_eachindex ()
21
- @benchmark updatey_eachindex ()
9
+ fillx (x) = for i in indices (x,1 ); x[i] = i; end
10
+ updatex (x) = for i in indices (x,1 ); x[i] = x[i] + i; end
11
+ updatex_eachindex (x) = for i in eachindex (x); x[i] = x[i] + i; end
22
12
13
+ @show @benchmark fillx (x)
14
+ @show @benchmark fillx (y)
15
+ @show @benchmark updatex (x)
16
+ @show @benchmark updatex (y)
17
+ @show @benchmark updatex_eachindex (x)
18
+ @show @benchmark updatex_eachindex (y)
You can’t perform that action at this time.
0 commit comments