Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The order did switch a little between runs, but that largely ceased once I stopped fiddling about with other processes while the benchmarks were running. I get the same for a locale using a dot as the decimal separator (same WSL system and perl, and also for Strawberry perl 5.28.1). I'll have to try on a native linux machine.

I'm not sure why your results are so different. The results I showed use a de_DE locale, so perhaps there is overhead when locale handling is triggered. There are also noise effects with benchmarking, although the numbers are pretty distinct in this case. It could also just be my system.

As for use strict and use warnings, I've been bitten before with string based benchmarking when trying to avoid sub overheads. Taking them out makes no difference to the results (see below, although there is one case where y is faster than s).

The underlying benchmark code actually calls no strict before it evals code passed as strings. Note the _doeval call in the code generation when a string is passed.

Results without strict and warnings:

de_DE.iso88591 3,1 3.1 3.1 Rate y_sprintf s_sprintf sprintf y_sprintf 4515837/s -- -34% -67% s_sprintf 6804054/s 51% -- -50% sprintf 13639660/s 202% 100% -- Rate s_sprintf y_sprintf sprintf s_sprintf 4065578/s -- -14% -64% y_sprintf 4737930/s 17% -- -58% sprintf 11298563/s 178% 138% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4822333/s -- -36% -61% s_sprintf 7501079/s 56% -- -39% sprintf 12255085/s 154% 63% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4712721/s -- -40% -65% s_sprintf 7853825/s 67% -- -42% sprintf 13493133/s 186% 72% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4521907/s -- -33% -66% s_sprintf 6739662/s 49% -- -50% sprintf 13393012/s 196% 99% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4736894/s -- -37% -58% s_sprintf 7546779/s 59% -- -34% sprintf 11352494/s 140% 50% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4954521/s -- -9% -68% s_sprintf 5458237/s 10% -- -64% sprintf 15366383/s 210% 182% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4728476/s -- -33% -65% s_sprintf 7101698/s 50% -- -47% sprintf 13504703/s 186% 90% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4823862/s -- -21% -65% s_sprintf 6083467/s 26% -- -56% sprintf 13732768/s 185% 126% -- Rate y_sprintf s_sprintf sprintf y_sprintf 4290706/s -- -39% -65% s_sprintf 6993552/s 63% -- -42% sprintf 12119185/s 182% 73% --

In reply to Re^6: A locale independent sprintf? by swl
in thread A locale independent sprintf? by swl

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 surveying the Monastery: (7)
As of 2024-04-24 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found