On 06/06/2011 06:53 PM, Christian Siefkes wrote:
> I've just seen that somebody already did the same, but I too tried to
> optimize your wordcount implementation a bit and got to the following Vala
> program:
Meanwhile I fixed the program so that it will actually show the correct
output, i.e. the
Hi Serge and all,
Serge Hulne wrote:
> Actually, what I do not grasp is the following:
>
> - Vala is allegedly just a thin object-oriented layer on top of C (glib2).
>
> - One might therefore expect a runtime performance which is closer to
> say C or C++, than to the (slower) performance of a h
The attached code produces the following:
$ time wc shaks12.txt ; time ./vwc shaks12.txt
124456 901325 5582655 shaks12.txt
real0m0.144s
user0m0.139s
sys 0m0.004s
lc = 124456. wc = 1293934
real0m0.161s
user0m0.157s
sys 0m0.003s
So a not so big difference. It really dep
On Mon Jun 6 17:02:43 2011, Serge Hulne 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()
---
In other words : text processing in *pure Vala* is a lot slower
On Mon, Jun 6, 2011 at 5:02 PM, Serge Hulne 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
> 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()
---
In other words : text processing in *pure Vala* is a lot slower than
in C (or C++ for that matter)
Conse
Le lundi 06 juin 2011 à 16:13 +0200, Emmanuel Pacaud a écrit :
> Hi,
>
> Le lundi 06 juin 2011 à 16:03 +0200, Serge Hulne a écrit :
> > - However, it turns out that, surprisingly Vala is not only slower
> > than C and C++ but even slower than Python.
> >
> > This is the part that I do not underst
On Mon, Jun 6, 2011 at 10:03, Serge Hulne wrote:
> Actually, what I do not grasp is the following:
>
> - Vala is allegedly just a thin object-oriented layer on top of C (glib2).
>
> - One might therefore expect a runtime performance which is closer to
> say C or C++, than to the (slower) perform
2011/6/6 Гаврилов Максим :
> You can benefit reducing code writing time from months to weeks and
> forgetting about memory leaks, pure-procedure programming and other pretty
> things you used to do in C.
... at the cost of a huge runtime performance penalty.
A similar claim was made by the deve
You can benefit reducing code writing time from months to weeks and
forgetting about memory leaks, pure-procedure programming and other pretty
things you used to do in C.
06.06.2011 18:11 пользователь "Serge Hulne" написал:
> On Mon, Jun 6, 2011 at 3:57 PM, Alexandre Rosenfeld
> wrote:
>> Or do a
Hi,
Le lundi 06 juin 2011 à 16:03 +0200, Serge Hulne a écrit :
> - However, it turns out that, surprisingly Vala is not only slower
> than C and C++ but even slower than Python.
>
> This is the part that I do not understand !
Look at the C code generated by valac. You will probably understand wh
On Mon, Jun 6, 2011 at 3:57 PM, Alexandre Rosenfeld
wrote:
> Or do a Vala program without GLib (using the posix profile for instance) and
> it will probably be closer to the C version.
Does that not kind of defeat the purpose ?
How do I benefit from the object-oriented features then ?
In parti
Actually, what I do not grasp is the following:
- Vala is allegedly just a thin object-oriented layer on top of C (glib2).
- One might therefore expect a runtime performance which is closer to
say C or C++, than to the (slower) performance of a high-level
language (like , e.g.Python).
- However
Or do a Vala program without GLib (using the posix profile for instance) and
it will probably be closer to the C version.
But again, you are comparing two very different things. Vala provides an
object-oriented language on top of the GObject system, which in the end
compiles to C code. Of course if
Why do you call it an equivalent version if there's no sign of Glib, garbage
collection, etc. in this code?
Just write a Glib-based wc in C, and it will be as fast as in Vala.
06.06.2011 17:07 пользователь "Serge Hulne" написал:
> Nope !
>
> Here is the equivalent version in C:
>
> #include
>
>
Nope !
Here is the equivalent version in C:
#include
#include
#include
int main(int argc, char** argv)
{
FILE *fp = NULL;
char buff[100], *fileName = NULL;
int wcnt = 0;
int lcnt = 0;
if (argc <2)
{
fprintf(stderr, "Usage: wc \n");
exit(1)
16 matches
Mail list logo