Are atomic operations supposed to be this costly?
Is memory and allocations required for simple read/write operations?
julia> a = Atomic{Int64}(0)
Atomic{Int64}(0)
julia> @btime a[]
100.546 ns (1 allocation: 16 bytes)
0
julia> @btime a[] = 100
101.535 ns (1 allocation: 16 bytes)
100
julia> a = 0
0
julia> typeof(a)
Int64
julia> @btime a
2.335 ns (0 allocations: 0 bytes)
0
julia> @btime a = 100
0.025 ns (0 allocations: 0 bytes)
100
The memory useage when looping on a single array with 1000 integers sometimes goes upto
2 GB since an operation (not variable) requires memory.
Is it possible to be an error with the benchmarking tools?
Are any improvements expected in the near future?