http://qs321.pair.com?node_id=11118366


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

my goal was maintainability, if speed mattered, I'd move the declaration of the rules and rulesets out of the sub. redefining them each time is useless.

Also using regex-refs via qr// is faster, but code-refs allow implementing more complex rules if requirements change.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^2: Efficient way to verify scalar contents

Replies are listed 'Best First'.
Re^3: Efficient way to verify scalar contents
by haukex (Bishop) on Jun 22, 2020 at 13:44 UTC
    my goal was maintainability, if speed mattered, I'd move the declaration of the rules and rulesets out of the sub. redefining them each time is useless.

    Good point, modified:

    Rate choroba2 LanX2 choroba1 LanX1 haukex1 ori +g haukex2 choroba2 84800/s -- -8% -37% -38% -59% -68 +% -73% LanX2 91935/s 8% -- -32% -33% -56% -66 +% -71% choroba1 134606/s 59% 46% -- -2% -35% -50 +% -58% LanX1 136955/s 62% 49% 2% -- -34% -49 +% -57% haukex1 208522/s 146% 127% 55% 52% -- -22 +% -35% orig 267007/s 215% 190% 98% 95% 28% - +- -16% haukex2 318577/s 276% 247% 137% 133% 53% 19 +% --