Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Fundamental Benchmarks

by Lexicon (Chaplain)
on Apr 02, 2001 at 13:24 UTC ( [id://68961]=note: print w/replies, xml ) Need Help??


in reply to Re: Fundamental Benchmarks
in thread Fundamental Benchmarks

To be sure, I've done quite a bit of work on Algorithmic optimization. What was some O(n!) time at first is now O(1) or O(n) (depending on use). But certain implimentation details lead me to need to choose between a Subroutine call vs a 2D-array lookup. I hadn't realized the Array would be so fast, even with 1 million cells. Subroutine calls are far more expensive than I expected. The array implimentation will probably increase the speed of the algorithm by 2-4 times, which makes me very satisfied that I went ahead and checked.

For my purposes, I'm fairly confident, as I imagine that a subroutine will always be a few order of magnitude slower than an Array. All this assuming that my results have any lasting meaning at all, of course. ;)

If people would dedicate a few minutes to look at this on different systems, that would be quite sweet. This particular benchmark ran under Redhat in Perl 5.00503. The box is (I think) a K6-2 250 with 256MB Ram, but I could be wrong on that processor. I'll post an ActiveState 5.6.0 under NT tomorrow if I get a chance.

-Lexicon

Replies are listed 'Best First'.
Happy to oblige
by ChemBoy (Priest) on Apr 04, 2001 at 02:04 UTC
    This is on an 270 MHz IP-27 (alternatively R12000--I'm not sure which label means more), using Perl 5.004_04.
    A = 10 B = 1000000 Benchmark: timing 10 iterations of 1 Nothing , 2 Mult , 3 Array + , 4 Hash , 5 Sub (Ref), 6 Sub (Val)... 1 Nothing : 30 secs (28.53 usr 0.03 sys = 28.56 cpu) 2 Mult : 63 secs (49.93 usr 0.07 sys = 50.00 cpu) 3 Array : 42 secs (37.05 usr 0.04 sys = 37.09 cpu) 4 Hash : 99 secs (95.28 usr 0.09 sys = 95.37 cpu) 5 Sub (Ref): 127 secs (117.77 usr 0.09 sys = 117.86 cpu) 6 Sub (Val): 98 secs (93.28 usr 0.11 sys = 93.39 cpu)
    Edit: fixed careless markup (sorry)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://68961]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found