[cfe-dev] Question about optimization of new and delete
Nicola Gigante
nicola.gigante at gmail.com
Mon Sep 30 08:13:43 PDT 2013
Il giorno 30/set/2013, alle ore 15:11, Hal Finkel <hfinkel at anl.gov> ha scritto:
>
> The criteria have not yet been decided, and I think some experimentation will be necessary. In the current implementation, the conversion happens for all allocations provably less than 1024 bytes. However, we may want to cap the total size of converted mallocs in addition to, or instead of, the individual sizes. Maybe this cap should depend on how much stack memory is already being requested by the function. I'm certainly open to suggestion.
>
Capping the total size seems more reasonable to me, but as you said, it's necessary to experiment.
Anyway, I was thinking about a tradeoff between stack usage and speed based on the "hotness" of the code (how to call it?). For example a
relatively big allocation inside a tight loop might be lowered while an allocation of the same size at function scope would not.
Also, I think the function being recursive and/but getting transformed by tail call elimination should be factors to take into account.
What do you think?
>
> Is there a call to the destructor after the store? If so, then we might not know that the destructor does not access the stored value.
>
No there's not. The issue exists with an empty class with only the member.
Thanks,
Nicola
More information about the cfe-dev
mailing list