Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

RE: RE: Schwartzian Transform vs. plain Perl

by mikfire (Deacon)
on Jun 08, 2000 at 17:50 UTC ( [id://17080]=note: print w/replies, xml ) Need Help??


in reply to RE: Schwartzian Transform vs. plain Perl
in thread Schwartzian Transform vs. plain Perl

As long as both functions are doing the hash generation, my first estimation is that it won't change the relation between the methods. I could go through lots of mathematical gyrations, but I won't.

Thinking a bit more about it, the first function to run may get more penalized than the second, depending on how aggressive perl is in reusing memory. The first call to initialize the hash will have to allocate memory from the system. After the my'd hash goes out of scope, the memory is marked as free but perl doesn't give it back to the system. The next time the hash is allocated, perl may ( again, depending on how aggressive perl is ) just give it the same space. This should be faster than trying to malloc the same amount of space.

Given 100,000 iterations of each loop I still do not think the penalty is going to be large enough to introduce any skew.

Personally, I also try to do that stuff outside of the timing loop - I want to remove as many distractions as possible and make sure I am timing how fast the sort is, not how fast my machine can allocate memory or how effectively perl is reusing it.

mikfire

  • Comment on RE: RE: Schwartzian Transform vs. plain Perl

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 05:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found