[graphds.h] Allocate graph from obstack

Richard Guenther richard.guenther@gmail.com
Sun Aug 19 16:55:00 GMT 2012


On Sat, Aug 18, 2012 at 8:10 PM, Dimitrios Apostolou <jimis@gmx.net> wrote:
> Initially I had one obstack per struct graph, which was better than using
> XNEW for every edge, but still obstack_init() called from new_graph() was
> too frequent.
>
> So in this iteration of the patch the obstack is static global, initialised
> once and never freed. Please advise on whether this is acceptable, and also
> where I should initialise the obstack once, and avoid checking if it's NULL
> in every use.
>
> Minor speed gains (couple of ms), tested with pre-C++ conversion snapshot,
> I'll retest soon and post update.

Either an obstack per graph or the ability to specify an obstack for allocation.
A global obstack with global lifetime is bad IMHO.

Richard.


>
> Thanks,
> Dimitris



More information about the Gcc-patches mailing list