[units] c++11 features to speed up compilation times

Hi, I was wondering if there was a policy for boost including C++11 features into the libraries. Obviously there might be many projects out there that do not (yet) have access to a compiler implementing the new standard or choosing not to use such a compiler. Anyways I was looking for a dimensional analysis library for compile time units checking and found Boost.Units to be quite slow at compile time even for the relatively small example code in the quickstart documentation. So I've written a bit of code that follows the approach of Boost.Units but uses C++11 features (constexpr, variadic templates, suffix operator, auto). It is not a complete library that I would use in a production environment, but it looks promising, since compilation times are about a factor 2-3 faster on my machine. It would be great if some of you could take a look. https://github.com/legento/units Maybe one could add an implementation like that to Boost.Units as a C++11 compiler detected feature to speed things up. Maybe I am totally wrong and it is some coincidence that this compiles faster on my platform. I did just minimalistic 'ok it seems to work' testing and was about as thorough with measurements. So see this as an implementation sketch. Regards Oliver

Hi,
I was wondering if there was a policy for boost including C++11 features into the libraries. Obviously there might be many projects out there that do not (yet) have access to a compiler implementing the new standard or choosing not to use such a compiler.
Anyways I was looking for a dimensional analysis library for compile time units checking and found Boost.Units to be quite slow at compile time even for the relatively small example code in the quickstart documentation. So I've written a bit of code that follows the approach of Boost.Units but uses C++11 features (constexpr, variadic templates, suffix operator, auto). It is not a complete library that I would use in a production environment, but it looks promising, since compilation times are about a factor 2-3 faster on my machine. It would be great if some of you could take a look.
https://github.com/legento/units
Maybe one could add an implementation like that to Boost.Units as a C++11 compiler detected feature to speed things up. Maybe I am totally wrong and it is some coincidence that this compiles faster on my platform. I did just minimalistic 'ok it seems to work' testing and was about as thorough with measurements. So see this as an implementation sketch. I'm sure that the Unit author will accept patches going forward a C++11 implementation. I suggest you to prepare a patch to introduce constexpr and another to variadic templates separately and see how this improves
Le 19/03/13 13:44, Oliver Esser a écrit : the compilation time. Even if the compilation time is not improved substantially these should improve the library however. Concerning suffix operator, this is a new and desirable feature by itself that needs a little bit more discussion. Of course, the patches should include also documentation and test updates. Best, Vicente

On 19-03-2013 19:36, Vicente J. Botet Escriba wrote:
Le 19/03/13 13:44, Oliver Esser a écrit :
Maybe one could add an implementation like that to Boost.Units as a C++11 compiler detected feature to speed things up. Maybe I am totally wrong and it is some coincidence that this compiles faster on my platform. I did just minimalistic 'ok it seems to work' testing and was about as thorough with measurements. So see this as an implementation sketch. I'm sure that the Unit author will accept patches going forward a C++11 implementation. I suggest you to prepare a patch to introduce constexpr and another to variadic templates separately and see how this improves the compilation time. Even if the compilation time is not improved substantially these should improve the library however.
+1. Please make the accessor function constexpr too, to we can perform full compile time computations. -Thorsten
participants (3)
-
Oliver Esser
-
Thorsten Ottosen
-
Vicente J. Botet Escriba