Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

RE: Re: Algorithm Efficiency vs. Specialized Hardware?

by btrott (Parson)
on Jun 21, 2000 at 00:15 UTC ( [id://19096]=note: print w/replies, xml ) Need Help??


in reply to Re: Algorithm Efficiency vs. Specialized Hardware?
in thread Algorithm Efficiency vs. Specialized Hardware?

Wondering why the original benchmark didn't work as it should, lhoward said:
> (I think its some sort of quoting/scoping problem, > but I'm not sure exactly what).
It's a scoping problem. The quoted code (Grep2) isn't accessing the same %url hash as the other two pieces of code, which you could tell if you had warnings on. You get a warning about a "Useless use of list slice in void context" for that code.

Why aren't the others in void context? Grep is accessing the lexical %url because it's lexical to the file scope, and the Grep subroutine is defined in this file. And Grep3 (the third one) is accessing the same lexical %url because the anonymous sub acts as a closure (I think).

So Grep2 is looking at a different (not defined) %url, and is thus not actually a very good test in terms of benchmarking. :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-19 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found