← Back to team overview

unity-dev team mailing list archive

Re: Faster dash

 

On 05/24/2012 06:20 PM, Marco Trevisan (Treviño) wrote:
> 2012/5/24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@xxxxxxxxxxxxx>:
>> On 05/23/2012 09:38 PM, Marco Trevisan (Treviño) wrote:
>> Currently glib::Source is very simple and I've only designed it to
>>> wrap the glib struct, but probably we could improve that also to be
>>> reused.
>> If we actually use that many you might try to reduce memory fragmentation by
>> making the glib::Source class castable to a GSource (ie. by having a GSource
>> value as the first member in the struct). Or if glib::Source is primarily
>> stack allocated this doesn't matter, of course.
> glib::Source's are mostly heap allocated... I could make them
> wrappable to a GSource* with some changes, but is this really
> improving a lot the things, construction and destruction of the
> wrapper and the wrapped objects should mostly happen at the same time
> there.

Note that GSources are ref-counted, so stack allocation is not possible
really. It would be quite "interesting" to do a c++ wrapper with just
one alloc (for one the class couldn't have any virtual members).


References