On Sat, 2012-06-02 at 15:47 +0200, pin...@centrum.cz wrote:
>  Compiled by: dmcs Main.cs
>  Run by: ./Main.exe
>  Output: Took: creating: 0.388, processing: 0.212
>  
>  [...]
>  
>  Compiled by: valac main.vala -X -O2
>  Run by: ./main
>  Output: Took: creating: 0.000034, processing: 0.455629

> [...]

>  It seems that Vala is 10 times slower than mono by default and 2 times with 
> optimizations.
>  How is that possible?

For large heap allocations, as in your example, glibc (and thus Vala)
uses mmap which uses copy-on-write of a zero page to only physically
allocate if and when the memory area is actually written to. Mono
doesn't appear to use the same approach. This is why the allocation is
faster and the processing is slower with Vala. You need to compare the
sum of allocation and processing for a fair comparison, and in that case
Vala wins with typical -O2 optimizations according to your numbers.

Alternatively, you could configure glibc to never use mmap and rerun the
tests. I don't remember the specific environment variables off the top
of my head but you should be able to find them in the man pages.

Regards,
Jürg

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to