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

Re^4: Count non-empty hash values

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


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

grep length, values %a
is even faster.
Rate OP other fishbot Joost ikegami OP 186/s -- -34% -67% -88% -90% other 280/s 51% -- -51% -82% -84% fishbot 571/s 207% 104% -- -64% -68% Joost 1578/s 750% 463% 176% -- -12% ikegami 1798/s 868% 542% 215% 14% --

Replies are listed 'Best First'.
Re^5: Count non-empty hash values
by Joost (Canon) on Oct 23, 2005 at 00:36 UTC

      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://502255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2020-11-29 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?