Re: [Vala] GObject allocation / referencing... Why is so slow?
- From: Marco Trevisan (Treviño) <mail 3v1n0 net>
- To: vala-list gnome org
- Subject: Re: [Vala] GObject allocation / referencing... Why is so slow?
- Date: Sun, 16 Jan 2011 21:52:37 +0100
Il giorno sab, 15/01/2011 alle 20.30 +0000, Aleksander Wabik ha scritto:
There are other relevant reasons to choose Vala over
C#, but speed is not one of them. :)
This is... very sad.
I agree :(
On the other hand, it should be strongly encouraged to generate such code
by the compiler. Why use g_type_create_instance()? Yes, it's helluva
reusable, you can create any typed class instance with it. And lose the
performance contest badly. But the compiler (valac) COULD generate a
function for each class, a function that would create instance of such
class by (for example) just allocating memory and memsetting it with
an "newly created class of such type" template. We need per-class
specific creation functions anyway, they're called constructors.
This would help a lot I guess, also looking at the stats, I also think
that maybe could be created however a new typed object compatible with
GType (soo keeping compatibility with many glib features) too simulating
some roles of g_type_create_instance, but reducing its computation (I
mean using a "light version" of that).
Other thing: why delete objects when refcounting drops to 0? Let's
maintain a queue of some size (maybe tweakable by a class attribute) of
objects that will be just re-initialized when operator new is called?
This is a matter of general design.
This could be a cool optimization, but as shown also in other posts of
the thread, this is not the operation that slows down the most our
classes... I thing that the allocation seems to be the bad monster here.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]