This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Performance of the default Node Allocator.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]