Indeed, it’s easy to test and prove that @mbauman is wrong. If you remove all usage of @pure
:
julia> @btime $A\$(v1+2v2+3v3+4v4+5v5)
13.384 μs (150 allocations: 11.94 KiB)
And after pasting the Base.:\
method into the REPL for the second time
julia> @btime $A\$(v1+2v2+3v3+4v4+5v5)
9.251 μs (146 allocations: 11.78 KiB)
As you can see, without the usage of @pure
the same performance difference exists after pasting the method into the REPL, and also it is much slower without the @pure
annotations.
It’s most likely that this is the same issue @schmrlng referenced above.