This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Simplify / speed up _Index_tuple and _Build_index_tuple
- From: Paolo Carlini <pcarlini at gmail dot com>
- To: Daniel Frey <d dot frey at gmx dot de>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 22 Jan 2010 17:46:30 +0100
- Subject: Re: Simplify / speed up _Index_tuple and _Build_index_tuple
- References: <A80D8C23-A3F8-4A93-8E1B-41009EA72257@gmx.de>
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