On Dec 3, 6:56 am, shlo...@iglu.org.il (Shlomi Fish) wrote:
> Hi matt!
>
> On Wednesday 02 Dec 2009 18:29:53 matt wrote:
>
>
>
> > On Dec 1, 8:58 pm, practicalp...@gmail.com wrote:
> > > Hello,
>
> > > Maybe it's not so suitable to ask this here.
> > > But is there a good way (code sample?) to implement a speed test
> > > between Perl and C?
> > > For a project which handles lots of data we want to know how slower
> > > perl is than C.
>
> > > Thanks.
>
> > To perform the test, I'd just use 'time':
>
> > test.cc:
> > int main()
> > {
> >         int a = 1 + 1;
> > }
>
> > test.pl:
> > #!/sw/bin/perl
> > $a = 1 + 1;
>
> Just a few notes:
>
> In both of these cases, the "1+1" expression should be evaluated at compile-
> time by the compilers, because it contains nothing but constants. Furthermore,
> g++ may be smart enough to see that you're not doing anything with "a" and to
> do nothing in this case.
>
> A more representative example would be one that inputs two integrarl arguments
> (from argv/@ARGV or STDIN) and adds them in run-time.

Agreed...I don't do much with compiled languages these days...my
apologies for the oversight.

[snip]

> One should note that there's also the overhead of the bash loop here.

Valid, but I considered it to be irrelevant as both executables were
subjected to the same loop.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to