[Patch] mt_allocator: spare mem & fix alignment problems
Dhruv Matani
dhruvbird@gmx.net
Fri Mar 26 12:57:00 GMT 2004
On Fri, 2004-03-26 at 17:52, Paolo Carlini wrote:
> Hi,
>
> [snip]
>
> Thanks for your interesting observations: in my opinion first we must figure
> out *exactly* where that 10x comes from...
>
> >Another couple of issues that are pending would be:
> >
> >1. The use of the div instruction on every call of deallocate to
> >calculate the nodes to be removed. This is quite a high latency
> >instruction, but I don't know how much the performance is affected.
> >
> >
> Probably not much, but I agree that we had better avoiding it, if
> possible. I'll
> give it a try in a forthcoming batch of minor cleanups.
You could try this divide by 10 algorithm. It would give even mul a run
for it's money.
template <typename Int>
inline Int divide_by_10(register Int Num)
{
register Int temp = Num;
Num <<= 1;
Num += temp;
Num += temp >> 2;
Num >>= 5;
return Num;
}
Or for more accuracy:
template <typename Int>
inline Int divide_by_10(register Int Num)
{
Num -= Num >> 2;
Num += Num >> 4;
Num += Num >> 8;
Num >>= 3;
return Num;
}
>
> >2. The algorithm for giving back nodes to the global pool. Instead of
> >clipping out one node at a time, why not splice out a whole bunch of
> >nodes, and put them all in at one shot? Just a thought. I can prepare a
> >patch for this one if needed.
> >
> >
> Looks like a nice idea. Please put together a patch for public scrutiny.
It's attached.
Just wondering, why aren't we incrementing the used count for the global
pool while adding blocks to it?
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_mt_alloc.dhruv.diff
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040326/c01ce024/attachment.bin>
More information about the Gcc-patches
mailing list