|
|
Message-ID: <16324243.Emhk5qWAgF@tjmaciei-mobl5>
Date: Tue, 04 Nov 2025 09:24:25 -0800
From: Thiago Macieira <thiago@...ieira.org>
To: The 8472 <the8472.rs@...inite-source.de>, Rich Felker <dalias@...c.org>,
Alejandro Colomar <alx@...nel.org>, Thiago Macieira <thiago@...ieira.org>,
Florian Weimer <fw@...eb.enyo.de>, libc-alpha@...rceware.org,
musl@...ts.openwall.com, Arthur O'Dwyer <arthur.j.odwyer@...il.com>,
Jonathan Wakely <jwakely@...hat.com>
Subject: Re: Re: realloci(): A realloc() variant that works in-place
On Tuesday, 4 November 2025 02:31:38 Pacific Standard Time Szabolcs Nagy wrote:
> is there an analysis with actual numbers so one
> can see the tradeoffs instead of speculating?
> we know that users think a new api would be
> useful, but some evidence is needed.
I'm modifying Qt to insert a "reallocateInPlace" call where it would
eventually be, with an out-of-line function that currently simply fails all
the time because I neither have xallocx() nor realloci(). In spite of that,
disassembly shows the compiler is not inlining it even in LTO mode.
In fact, just by looking at the places where it is being called from reveals
the data types that could benefit from this. And some that could benefit from
realloc() in the first place, if only we could declare & detect the type in
question bitwise trivially relocatable.
A quick check with the qtdiag application shows it did get called:
Thread 1 "qtdiag" hit Breakpoint 1, QArrayData::reallocateInPlace
(data=0x5555555bdc30, objectSize=48, alignment=16, capacity=3,
option=QArrayData::Grow)
Thread 1 "qtdiag" hit Breakpoint 1, QArrayData::reallocateInPlace
(data=0x5555555c8920, objectSize=48, alignment=16, capacity=6,
option=QArrayData::Grow)
Thread 1 "qtdiag" hit Breakpoint 1, QArrayData::reallocateInPlace
(data=0x5555555ccf50, objectSize=48, alignment=16, capacity=11,
option=QArrayData::Grow)
Thread 1 "qtdiag" hit Breakpoint 1, QArrayData::reallocateInPlace
(data=0x5555555cd600, objectSize=48, alignment=16, capacity=22,
option=QArrayData::Grow)
I'll have more information for a more complex application once I finish
rebuilding everything.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Download attachment "signature.asc" of type "application/pgp-signature" (871 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.