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?
Attachment:
object-allocator.vala
Description: Text Data
Attachment:
object-allocator-my.c
Description: Text Data
Attachment:
object-allocator.cs
Description: Text Data