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



The attached code produces the following:

$ time wc shaks12.txt ; time ./vwc shaks12.txt 
 124456  901325 5582655 shaks12.txt

real    0m0.144s
user    0m0.139s
sys     0m0.004s
lc = 124456. wc = 1293934

real    0m0.161s
user    0m0.157s
sys     0m0.003s

So a not so big difference. It really depends on how and what you code.

- fabian

Am Montag, den 06.06.2011, 17:14 +0200 schrieb Luca Dionisi:
On Mon, Jun 6, 2011 at 5:02 PM, Serge Hulne <serge hulne gmail com> wrote:
Hint: Luca already told you why the vala version is slower...

       Emmanuel.




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

You can try and use strtok and fgets
http://valadoc.org/references/posix/0.11.5/Posix.strtok.html
http://valadoc.org/references/posix/0.11.5/Posix.FILE.gets.html
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list

Attachment: vwc.vala
Description: Text Data



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