PSA: Compiler optimisation remarks

I mainly try to make algorithms as simple and generic as possible, and assume the compiler will do the rest with regards to inlining and specialization. This generally bears out, and the compiler engineers deserve all the praise in the world for that.

There’ll always be room for improvement, of course. I’ve recently been wondering whether, if the compiler and/or language becomes capable of identifying pure functions, it’d be possible to have some limited form of automatic parallelization in ostensibly synchronous code. After all, Swift’s concurrency model doesn’t really work if there’s nothing to wait on.

1 Like