Re: [Vala] GObject allocation / referencing... Why is so slow?
- From: Jonathan Ryan <jryan curious-os com>
- To: vala-list gnome org
- Subject: Re: [Vala] GObject allocation / referencing... Why is so slow?
- Date: Fri, 14 Jan 2011 15:01:22 -0500
Looks like mono is calling a function called mono_new_fast, maybe this
is an optimzation due to the simplicity of the code? If that's the case
mono might be treating them as if you just used a struct in C, which is
also a different case. Sorry for sending so many separate emails.
On 01/14/2011 02:31 PM, Jonathan Ryan wrote:
You're C code doesn't use GObject, so why are you comparing it to
GObject? GObject provides more functionality than your code, including
thread safe reference counting, which is also taking time up in the
profile.
On 01/14/2011 02:25 PM, Jonathan Ryan wrote:
Second of all each iteration your object is being unreferenced. If do
you a profile, ~6% of that time is being spent unreferening the
object. This could also expalin the differences in time considering
C#'s garbage collector does not use reference counting as does
GObject, so it's problaby not deallocating those new objects you
create them each loop, which would increase the time signifiacantly.
On 01/14/2011 02:17 PM, Jonathan Ryan wrote:
First of all your "Objects" aren't GObjects, you need to
private class TestObject : Object
for them to be GObjects. The generated code is much different.
On 01/14/2011 11:28 AM, Marco Trevisan (Treviño) wrote:
I'm doing some benchmarks with Vala, but I found that its performances
aren't so great as I expected when a class is used, and mostly when
it's
allocated/referenced multiple times...
Consider, for example, the simple example attached... The source
simply
allocates many TestObject's, referencing them in varius ways, and then
freeing them after some time. Maybe it's not perfect, but it does
what I
wanted.
However, also if the created object is very simple Vala with the
gobject
profile it's quite slow.
In fact, also if with the results can't be compared to the
hand-written
C attached code (I've written it fastly, maybe it has errors :P),
comparing Vala+Gobject and Vala+Dova underlines some differences:
| N | Vala-Gobject | Vala-Dova | Handwritten C |
Mono C# |
|-------------+----------------+--------------+--------------------------|
| 5000000 | 2.367s | 0.952s | 0.310s |
0.404s |
|-------------+----------------+--------------+---------------+----------|
| 50000000 | 24.224s | 10.152s | 3.169s |
3.662s |
|-------------+----------------+--------------+---------------+----------|
| 100000000 | 48.402s | 20.364s | 6.126s |
7.112s |
|------------------------------------------------------------------------|
Now, the C code can't be beaten, of course, but if you compare the
Gobject profile to the Dova one (also if it's immature), there's a
great
performance gap!
And this gobject slowness is underlined in other more complex
benchmarks, compared to Dova too...
I guess that a gobject structure is really more complex compared to
the
ones defined by Dova (or by simple C), but if Vala has these
performances, due to GObject mamangement, even the (evil) Mono C#
seems
to be better (code attached, ported from the Vala syntax).
So, how to improve this? Is really everything related to gobject or is
it also Vala which has responsibilities in this?
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]