https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114563
--- Comment #15 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 1 Apr 2025, ak at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114563 > > ak at gcc dot gnu.org changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |ak at gcc dot gnu.org > > --- Comment #13 from ak at gcc dot gnu.org --- > > >so my idea was to have multiple freelists so that p->bytes == entry_size > >and this list walk, which is the bottleneck for PR119387 I think, is > >improved. > > It should be improved because the first element will near always match. > > I only kept the comparison for the fallback case: if there is no free list for > a given size so it puts the size into freelist[0]. But I'm not sure this can > actually happen (for simple tests it never triggers). If the fallback is > removed the comparison could be removed too, but it probably doesn't matter > for > performance. It does happen - I exchanged it with an assert and it triggered quickly. But yes, for all freelists but freelist[0] the first element is always a "hit", but not sure if that's worth optimizing. > >Using your patch this changes to > > >Samples: 1M of event 'cycles:Pu', Event count (approx.): 1053172130606 > > 0.02% 234 cc1plus cc1plus [.] alloc_page(unsigned int) > > >so the patch works as intended! > > Great. I will submit it for phase 1 if I don't forget. Thanks. I'll also try to rememeber (maybe you can post it now, stage1 should be only a few weeks away).