Atomic Operations are too expensive.

Are atomic operations supposed to be this costly?
Is memory and allocations required for simple read/write operations?

julia> a = Atomic{Int64}(0)

julia> @btime a[]
  100.546 ns (1 allocation: 16 bytes)

julia> @btime a[] = 100
  101.535 ns (1 allocation: 16 bytes)

julia> a = 0

julia> typeof(a)

julia> @btime a
  2.335 ns (0 allocations: 0 bytes)

julia> @btime a = 100
  0.025 ns (0 allocations: 0 bytes)

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?

No. They are not supposed to be this costly. And they are indeed cheaper and non-allocating on my 0.6.3, but really slow on my 0.7.0-alpha.136. So I’d guess this is yet another transient performance bug on 0.7

edit: Issue is opened

Yes they are supposed to be more expensive but no they are not supposed to allocate and no you are not benchmarking correctly since a is a non const global.

And see the issue linked above for the correct way to use the macro.