Using static templates instead of generate them dynamically.

Until now, all templates were generated dynamically, I changed it to use static templates.

This is the first step to use precompiled templates. Now we just need to precompile them when building the library.

We also have some performance improvements, it's up to 40% faster, specially on mobile devices.