Re: [Vala] Fwd: Why is Vala 10 times slower than C ?

On Mon Jun 6 17:02:43 2011, Serge Hulne wrote:

Hint: Luca already told you why the vala version is slower...


Luca said:
read_line() is not as cheap as a getline()
str.split() is not as cheap as strtok()

In other words : text processing in *pure Vala* is a lot slower than
in C (or C++ for that matter)

Consequently :
Vala does not appear to be suited for heavy text processing tasks such
as NLP : natural language processing.
(unless there is an essential part of the concept of Vala that eludes me)


Your naive implementation of WC and comparing it to wc itself (that does byte by byte processing of the input stream and is optimized) does not give grounds to say this.

Yes the higher level api you use, the slower it gets. But this is also valid for C.

this is how wc is implemented in coreutils:

this is not trivial to write. I suspect that without adding a lot of code your VALA code can be speed up a lot (say 2-3 times wc speed, but this is a wild guess) and still be more readable and a lot faster to write then the above code. That is the power of vala .

You can write complex code very fast, and if you need the code to be very fast you can easily write the critical loops optimized. (f.e. by using posix functions)


vala-list mailing list
vala-list gnome org

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