[Patch] Avoid divisions is __mt_alloc::deallocate

Paolo Carlini pcarlini@suse.de
Fri Apr 2 09:44:00 GMT 2004


Hi,

this patchlet rearranges the arithmetic in order to avoid computing
two expensive divisions at each deallocation: now only one at each
removal of a bunch of blocks (~ 1/1000). Yesterday, I enjoyed *so*
much this little thread:

  http://sources.redhat.com/ml/libc-alpha/2004-03/msg00301.html

and became even more sensitive to the issue (*) ...

Of course I have checked that there are no risks of overflows.

The existing comments were not particularly clear, I will work on that
in follow on work.

By the way, there is also a correctness bit in it: we were using 'int'
which is too small (32 bits) on 64-bit machines.

Regtested x86-linux, will commit later today.

Paolo.

(*) I'm planning to survey the whole library for that.

////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_mt_5
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040402/45e62d39/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_mt_5
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040402/45e62d39/attachment-0001.ksh>


More information about the Libstdc++ mailing list