Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^6: Count non-empty hash values

by ikegami (Pope)
on Oct 23, 2005 at 03:05 UTC ( #502277=note: print w/replies, xml ) Need Help??


in reply to Re^5: Count non-empty hash values
in thread Count non-empty hash values

That catches undefined values (most likely good) but also catches 0 and "0" (most likely bad). Checking for truth had occured to me, but I decided to be consistent with the other solutions, and "0" counting as empty was too big a question mark. Checking for truth is 22% faster than checking the length, though:

Rate OP other fishbot Joost ikegami truth OP 193/s -- -32% -67% -88% -89% -91% other 284/s 47% -- -52% -82% -84% -87% fishbot 592/s 207% 109% -- -62% -67% -73% Joost 1578/s 719% 456% 166% -- -13% -29% ikegami 1818/s 843% 540% 207% 15% -- -18% truth 2221/s 1052% 682% 275% 41% 22% --

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2021-01-27 17:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?