Statically optimize initializations performed by init function

I hope you'll forgive me for introducing an optimization at this point. But without this optimization, the compilation of packages in the standard library with large global initializers takes a ridiculously long time and slows down the development process. More details in the second commit message.