Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Did the inefficiency of /i get fixed?

by itub (Priest)
on May 19, 2004 at 14:22 UTC ( [id://354618]=note: print w/replies, xml ) Need Help??


in reply to Re: Did the inefficiency of /i get fixed?
in thread Did the inefficiency of /i get fixed?

The inefficiency is true and very important if you are using Unicode strings, because lowercasing Unicode characters is slow. Consider this modified benchmark:

use utf8; use Benchmark 'cmpthese'; my $y = "HELLO ΑΙΝΣΪ" x 100; # make sure your script is encoded in UTF-8 when you save it! # ... the rest of the code is the same as in the parent node

Results:

                 Rate i_complex cc_complex complex complex_fail i_simple simple_fail simple cc_simple
i_complex       672/s        --       -68%    -70%         -71%     -98%       -100%  -100%     -100%
cc_complex     2078/s      209%         --     -9%         -10%     -94%        -99%  -100%     -100%
complex        2278/s      239%        10%      --          -2%     -94%        -99%  -100%     -100%
complex_fail   2317/s      245%        12%      2%           --     -94%        -99%  -100%     -100%
i_simple      35860/s     5234%      1626%   1474%        1448%       --        -79%   -95%      -95%
simple_fail  168298/s    24935%      8001%   7289%        7164%     369%          --   -76%      -78%
simple       703114/s   104489%     33744%  30771%       30248%    1861%        318%     --      -10%
cc_simple    780570/s   116011%     37472%  34172%       33591%    2077%        364%    11%        --

Character classes are 3 times faster than /i for the complex case and 21 times faster for the simple case!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-03-29 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found