Is it fast?

So, you're interested in performance of this library? Well, I'm proud to say that the answer to your question is…

… Oh yes. However, the main objective of this library is not the speed, the main objective of this library is to provide compiler with as much info as possible. This library simply generates boilerplates you would have written and handles all the type information to the compiler so it could check it.

What does that mean to you, the user?

  • You will be getting compile time errors, not runtime errors
  • If we don't hide information behind polymorphism and virtual method tables compiler is free to optimize the code which can perform just as fast as the boilerplate in most cases.

Speed is just a side effect of providing information to the compiler so everything is essentially free!

In short, to make code generated by this library fast your compiler has to sweat. From my experience, I can say that for clang-3.5 compiler the sweat is quite good, because only rarely code compiled runs slower than the boilerplate version, and, usually it runs slower not for fun but because it does some necessary checks which would be segmentation faults or other errors otherwise.

That's why there's a project in github which you can compile and check for yourself. It runs benchmarks and generates the graph for you to see when templatious library performs as fast as the boilerplate (best case scenario) and when it performs not as fast as the boilerplate.