This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Performance of the default Node Allocator.
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: dhruvbird at gmx dot net
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Thu, 22 Jan 2004 17:06:42 -0600 (CST)
- Subject: Re: Performance of the default Node Allocator.
- References: <1074584842.1496.9.camel@home.free>
- Reply-to: rittle at labs dot mot dot com
In article <1074584842.1496.9.camel@home.free>,
Dhruv Matani<dhruvbird@gmx.net> writes:
>> OK, BSF does not exist on every architecture. The way to solve this
>> is rewrite the algorithm to use plain C. Compare the version with
>> plain C against the inline asm version. I expect you might find that
>> there is little difference in speed. If a measurable difference is
>> seen, I will teach you how we want to handle this in the library.
> I replaced it with it's software equivalent (in plain C), and the
> difference for my case is 0.02 ~ 0.03 seconds (which may go up for
> larger inputs!), so is there any way that we could make the library
> detect whether the current platform is i386, and if so, use the bsf
> instruction, else use the software emulation?
Please see these files for a concrete example of what you need to do:
libstdc++-v3/config/cpu/generic/atomicity.h
libstdc++-v3/config/cpu/i386/atomicity.h
From the above, infer that you need to create an inline function which
will be used in other parts of the library. I'd suggest adding a new
file (e.g.) [...]/bit-set-first.h .
Then study this to see how to pick the generic version vs. a per-CPU version:
libstdc++-v3/configure.host
Thank you for continuing to think about your patch's form while the
FSF paperwork is handled.
Regards,
Loren