Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P9016
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Jdforrester-WMF
on Aug 30 2019, 9:57 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F30170260: raw.txt
Aug 30 2019, 9:57 PM
2019-08-30 21:57:59 (UTC+0)
Subscribers
None
<?php
$dataS
=
@
file_get_contents
(
'./foo.data'
);
$dataJ
=
@
file_get_contents
(
'./foo.json'
);
// file_put_contents( './foo.json', json_encode( unserialize( $dataS ), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) . "\n" );
function
runS
()
{
global
$dataS
;
ob_start
();
$t
=
microtime
(
true
);
$i
=
0
;
while
(
$i
<
10000
)
{
unserialize
(
$dataS
);
++
$i
;
}
$tmp
=
microtime
(
true
)
-
$t
;
ob_end_clean
();
return
$tmp
;
}
// Test Source
function
runJ
()
{
global
$dataJ
;
ob_start
();
$t
=
microtime
(
true
);
$i
=
0
;
while
(
$i
<
10000
)
{
json_decode
(
$dataJ
);
++
$i
;
}
$tmp
=
microtime
(
true
)
-
$t
;
ob_end_clean
();
return
$tmp
;
}
echo
(
'Serial: '
.
runS
()
.
"
\n
"
);
echo
(
'JSON: '
.
runJ
()
.
"
\n
"
);
Event Timeline
Jdforrester-WMF
created this paste.
Aug 30 2019, 9:57 PM
2019-08-30 21:57:59 (UTC+0)
Log In to Comment