Re:Show HN: FunctionKit – Approachable functional concepts b...
by pseudonom- on Sunday April 22, 2018 @01:14AM
(#16894812)
When the compiler handles this, it is usually called "automatic deforestation". One technique for this (that Haskell's compiler implements) is "stream fusion". A brief overview of stream fusion is given at https://stackoverflow.com/questions/578063/what-is-haskells-... and a lengthier paper is at http://fun.cs.tufts.edu/stream-fusion.pdf.
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).