Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: To Findout Prime number

by andreas1234567 (Vicar)
on Feb 11, 2008 at 06:57 UTC ( #667337=note: print w/replies, xml ) Need Help??

in reply to Re^2: To Findout Prime number
in thread To Findout Prime number

nowadays it's much faster to use substr
I re-ran your benchmark on Linux 2.6.9 i686, perl v5.8.5 built for i386-linux-thread-multi. The difference was much less than what you encountered.
$ perl -w Benchmark: running substr, vec for at least 60 CPU seconds... substr: 67 wallclock secs (60.69 usr + 0.03 sys = 60.72 CPU) @ 0 +.58/s (n=35) vec: 66 wallclock secs (61.33 usr + 0.04 sys = 61.37 CPU) @ 0 +.54/s (n=33) s/iter vec substr vec 1.86 -- -7% substr 1.73 7% --
On Linux 2.6.22-10-386 i686, perl v5.10.0 (different hardware than above):
Benchmark: running substr, vec for at least 60 CPU seconds... substr: 62 wallclock secs (61.69 usr + 0.05 sys = 61.74 CPU) @ 0 +.44/s (n=27) vec: 61 wallclock secs (60.81 usr + 0.05 sys = 60.86 CPU) @ 0 +.39/s (n=24) s/iter vec substr vec 2.54 -- -10% substr 2.29 11% --
Update Mon Feb 11 12:13:38 CET 2008: Added perl 5.10 benchmark on lodin's request.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://667337]
[choroba]: managed to release Syntax::Construct with 5.28 support in the night, though
[Corion]: choroba: Whee ;)
[Corion]: marto: Ouch - I would've thought that kids adapt much better, but that's obviously not the case...
[marto]: well, their mother let them sleep till 15:00 & 12:00 last week, which didn't help them adjust :P
[Corion]: I was "productive" over the weekend in the sense that I revived my old "Perlmonks on SQLite" code, which likely means I can get a test instance back up running on my webhost. Small steps :)
[Corion]: marto: Ow, no, that doesn't help at all :)
[choroba]: Related to the new release, anyone could explain this or this tester report?
[Discipulus]: hello crew! marto thanks for the message: but I how can I help? i'm testing cpan Padre atm problem with Client::Debug
[choroba]: I don't happen to have 5.10.0 nor 5.8.5 handy...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2018-06-25 08:40 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.