Simplify / speed up _Index_tuple and _Build_index_tuple

Paolo Carlini pcarlini@gmail.com
Fri Jan 22 16:46:00 GMT 2010


Hi

> This is about <functional>'s internal helpers _Index_tuple and  
> _Build_index_tuple.
>
> I noticed that _Build_index_tuple is very complex and does not reuse  
> instantiations with lower numbers. To test, I instantiated it with  
> _Num = { 400, 401, 402, ..., 419 }, which took 6.5s to compile on my  
> machine. The improved version, which does reuse the instantiation of  
> _Build_index_tuple/_Index_tuple for _Num=418 for _Num=419, etc.  
> compiles in 0.3s - approx. 20x faster.
>
> Of course the above test is an extreme case, but it's IMHO also  
> easier to understand the new code. What do you think, worth it?

Without having checked the details, I'm away right now from my main  
machines, I'm pretty sure it's worth it: I knew for sure that somebody  
somewhere was implementing this stuff in a better way, but never got  
around studying the details. Nice that you did. I'll double check  
later today and likely commit at once.

Thanks!
Paolo



More information about the Libstdc++ mailing list