Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Efficient way to verify scalar contents

by tybalt89 (Prior)
on Jun 24, 2020 at 15:13 UTC ( #11118433=note: print w/replies, xml ) Need Help??


in reply to Re^2: Efficient way to verify scalar contents
in thread Efficient way to verify scalar contents

Out of curiosity, I tried tr/// instead of regex, much faster :)

sub validatetr { local $_ = shift; length >= 20 ? 1 : !tr/a-z// || !tr/A-Z// ? 0 : length >= 16 ? 1 : !tr/0-9// ? 0 : length >= 12 ? 1 : !tr/a-zA-Z0-9//c ? 0 : length >= 8 ? 1 : 0; }

Replies are listed 'Best First'.
Re^4: Efficient way to verify scalar contents
by haukex (Bishop) on Jun 25, 2020 at 06:36 UTC
    Out of curiosity, I tried tr/// instead of regex, much faster :)

    Looks like it's a winner :-)

    Rate BillKSmith2 choroba2 LanX2 choroba1 LanX1 haukex1 + BillKSmith1 orig tybalt89 haukex2 tybalt89_2 BillKSmith2 40957/s -- -53% -58% -71% -71% -82% + -84% -85% -85% -88% -91% choroba2 88071/s 115% -- -10% -38% -38% -61% + -65% -67% -69% -73% -82% LanX2 97356/s 138% 11% -- -31% -31% -57% + -61% -63% -65% -71% -80% choroba1 141499/s 245% 61% 45% -- 0% -37% + -44% -47% -50% -57% -70% LanX1 141499/s 245% 61% 45% 0% -- -37% + -44% -47% -50% -57% -70% haukex1 225463/s 450% 156% 132% 59% 59% -- + -11% -15% -20% -32% -53% BillKSmith1 252057/s 515% 186% 159% 78% 78% 12% + -- -5% -11% -24% -47% orig 265476/s 548% 201% 173% 88% 88% 18% + 5% -- -6% -20% -44% tybalt89 281788/s 588% 220% 189% 99% 99% 25% + 12% 6% -- -15% -41% haukex2 331918/s 710% 277% 241% 135% 135% 47% + 32% 25% 18% -- -30% tybalt89_2 476665/s 1064% 441% 390% 237% 237% 111% + 89% 80% 69% 44% --

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2020-10-29 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (270 votes). Check out past polls.

    Notices?