Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Why? Sounds premature to me
#!/usr/bin/perl -- use strict; use warnings; use Benchmark qw( cmpthese ); # Make bytes:: functions available, but use character semantics. use bytes; no bytes; cmpthese( -3, { bytes => sub { my $smileys = "\x{263a}" x 10_000; chop($smileys) while bytes::length($smileys); }, utf8 => sub { my $smileys = "\x{263a}" x 10_000; chop($smileys) while length($smileys); }, substr => sub { my $smileys = "\x{263a}" x 10_000; chop($smileys) while ord substr($smileys,0,1); }, notnot => sub { my $smileys = "\x{263a}" x 10_000; chop($smileys) while !! $smileys; }, '!!bytes' => sub { my $smileys = "\x{263a}" x 10_000; chop($smileys) while !! bytes::length($smileys); }, '!!utf8' => sub { my $smileys = "\x{263a}" x 10_000; chop($smileys) while !! length $smileys; }, 'ne""' => sub { my $smileys = "\x{263a}" x 10_000; chop($smileys) while $smileys ne ""; }, } ); __END__ Rate substr utf8 !!utf8 bytes !!bytes ne"" notnot substr 3.75/s -- -3% -4% -97% -97% -99% -99% utf8 3.86/s 3% -- -1% -97% -97% -99% -99% !!utf8 3.90/s 4% 1% -- -97% -97% -99% -99% bytes 119/s 3066% 2972% 2942% -- -0% -71% -74% !!bytes 119/s 3081% 2987% 2956% 0% -- -71% -74% ne"" 406/s 10740% 10419% 10314% 242% 241% -- -10% notnot 451/s 11928% 11572% 11455% 280% 278% 11% --

In reply to Re: Alternative to bytes::length() by Anonymous Monk
in thread Alternative to bytes::length() by creamygoodness

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-03-19 04:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found