>Isn't this an optimisation that could/should be handled by the compiler (JIT evaluation or something like that)?
Interesting question, which i also asked myself every once in a while, but unfortunately couldn't find a clear answer so far. Maybe someone with deeper understanding of swiftc or aot compilers in general here could clarify?
ps.: To give my reply a meaning. JIT optimization in particular can not happen here, because swift is an ahead of time compiled language, which means the compiler produces machine code which runs directly on your CPU. JIT is a thing for languages which run in a virtual machine (e.g. Java or C#) or an interpreter (e.g. Javascript).
Interesting question, which i also asked myself every once in a while, but unfortunately couldn't find a clear answer so far. Maybe someone with deeper understanding of swiftc or aot compilers in general here could clarify?
ps.: To give my reply a meaning. JIT optimization in particular can not happen here, because swift is an ahead of time compiled language, which means the compiler produces machine code which runs directly on your CPU. JIT is a thing for languages which run in a virtual machine (e.g. Java or C#) or an interpreter (e.g. Javascript).