Re: GProperty status



On Mon, Nov 12, 2012 at 07:23:50PM +0000, Emmanuele Bassi wrote:
> by using a bunch of shortcuts, GProperty avoids using GValue *a lot*;
> boxing and unboxing of values is done using C pointers, instead of
> touching GValue and the system allocator — and using correct copy
> semantics (the default ones), it's possible to avoid memory allocation
> completely. removing GValue boxing and unboxing gives us a pretty nice
> win, like it did for GSignal marshalling.

Hm, since things have got that far, would it also be possible to stop
emitting redundant "notify" if nothing changes?

It is easy to write my_foo_set_fudge_factor() so that

    my_foo_set_fudge_factor(foo, 1.0);
    my_foo_set_fudge_factor(foo, 1.0);
    my_foo_set_fudge_factor(foo, 1.0);
    my_foo_set_fudge_factor(foo, 1.0);

emits a notification at most the first time.  However,

    g_object_set(foo, "fudge-factor", 1.0, NULL);
    g_object_set(foo, "fudge-factor", 1.0, NULL);
    g_object_set(foo, "fudge-factor", 1.0, NULL);
    g_object_set(foo, "fudge-factor", 1.0, NULL);

is a much thougher adversary.

Since the obvious question is how can it tell, in general, that nothing
has changed I must add that I do not mind *writing code* to specify it
explicitly.  After all, this is what I do now to make at least the
functional setter behave sanely.

Regards,

Yeti



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]