When working at the REPL, you have to be careful with what you’re profiling. Your @time is probably measuring mostly just the dispatch time, and the time to create the vector. @btime is generally much more accurate. The dollar sign tells it to evaluate [1,2,3] before starting to measure the time.
So dot syntax will generate anomalous function which will be compiled every time? This seems to be a little unacceptable for performance considerations.
All Julia functions will compile the first time. No anomalies there . The REPL scope is dynamic so it compiles before running each time. That’s why it’s a performance tip to write functions.
but no. It needs recompilation for every appearance in the code, same as everything else so repeated running of the same source code location (not same source code text) does not need recompilation.
It might be an improvement if the compiler can recognize and cache result that can be reused but it’s unrelated to the runtime performance.