Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3584287
BenchmarkFallbacks
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
MaxSem
Mar 9 2016, 10:48 PM
2016-03-09 22:48:17 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
BenchmarkFallbacks
View Options
<?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
;
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3489258
Default Alt Text
BenchmarkFallbacks (1 KB)
Attached To
Mode
P2734 BenchmarkFallbacks
Attached
Detach File
Event Timeline
Log In to Comment