Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P2734
BenchmarkFallbacks
Active
Public
Actions
Authored by
MaxSem
on Mar 9 2016, 10:48 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F3584287: BenchmarkFallbacks
Mar 9 2016, 10:48 PM
2016-03-09 22:48:17 (UTC+0)
Subscribers
None
<?php
require_once
__DIR__
.
'/Benchmarker.php'
;
class
BenchmarkFallbacks
extends
Benchmarker
{
public
function
__construct
()
{
parent
::
__construct
();
$this
->
addDescription
(
'Compares the performance of mbstring fallbacks vs. native implementation'
);
}
public
function
execute
()
{
$cyrillicText
=
'Съешь ещё этих мягких французских булок, да выпей же чаю'
;
$this
->
bench
(
[
[
'function'
=>
'mb_substr'
,
'args'
=>
[
$cyrillicText
,
50
,
200
],
],
[
'function'
=>
'Fallback::mb_substr'
,
'args'
=>
[
$cyrillicText
,
50
,
200
],
],
[
'function'
=>
'mb_substr'
,
'args'
=>
[
$this
->
mDescription
,
50
,
200
],
],
[
'function'
=>
'Fallback::mb_substr'
,
'args'
=>
[
$this
->
mDescription
,
50
,
200
],
],
[
'function'
=>
'mb_strlen'
,
'args'
=>
[
$cyrillicText
],
],
[
'function'
=>
'Fallback::mb_strlen'
,
'args'
=>
[
$cyrillicText
],
],
[
'function'
=>
'mb_strlen'
,
'args'
=>
[
$this
->
mDescription
],
],
[
'function'
=>
'Fallback::mb_strlen'
,
'args'
=>
[
$this
->
mDescription
],
],
]
);
$this
->
output
(
$this
->
getFormattedResults
()
);
}
}
$maintClass
=
"BenchmarkFallbacks"
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
Event Timeline
MaxSem
created this paste.
Mar 9 2016, 10:48 PM
2016-03-09 22:48:17 (UTC+0)
MaxSem
mentioned this in
T129435: RFC: drop support for running without mbstring
.
Mar 10 2016, 2:08 AM
2016-03-10 02:08:52 (UTC+0)
Log In to Comment