Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^6: A locale independent sprintf?

by swl (Parson)
on Jul 29, 2020 at 11:58 UTC ( [id://11119959]=note: print w/replies, xml ) Need Help??


in reply to Re^5: A locale independent sprintf?
in thread A locale independent sprintf?

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% --

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-03-28 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found