This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// @see https://github.com/msgpack/msgpack-php/issues/90 | |
ini_set('memory_limit', '32G'); | |
require __DIR__.'/../vendor/autoload.php'; | |
if (extension_loaded('xdebug')) { | |
echo "The benchmark must be run with xdebug extension disabled.\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function range_keys($n, $data) { | |
for ($i = 0; $i < $n; ++$i) { | |
if ($data) { | |
$r = array_keys($data) !== range(0, count($data) - 1); | |
} else { | |
$r = []; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pack_cc($n) { | |
for ($i = 0; $i < $n; ++$i) { | |
$num = \pack('CC', 0xcc, 200); | |
} | |
} | |
function chr_cc($n) { | |
for ($i = 0; $i < $n; ++$i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function switch_gettype($n, $value) { | |
for ($i = 0; $i < $n; ++$i) { | |
switch (\gettype($value)) { | |
case 'array': continue; | |
case 'string': continue; | |
case 'integer': continue; | |
case 'NULL': continue; | |
case 'boolean': continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const UTF8_REGEX = '/\A(?: | |
[\x00-\x7F]++ # ASCII | |
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | |
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | |
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | |
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | |
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | |
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://blog.blackfire.io/php-7-performance-improvements-encapsed-strings-optimization.html | |
class Foobar | |
{ | |
public function getVal1() | |
{ | |
return rand(0, 1000); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\SKM\Benchmarks\Serialization\BooleanSerializationBench | |
benchSerializeJSON I9 P0 [μ Mo]/r: 0.201 0.195 (μs) [μSD μRSD]/r: 0.011μs 5.29% | |
benchSerializeJSON I9 P1 [μ Mo]/r: 0.202 0.196 (μs) [μSD μRSD]/r: 0.011μs 5.61% | |
benchDeserializeJSON I9 P0 [μ Mo]/r: 0.386 0.385 (μs) [μSD μRSD]/r: 0.002μs 0.48% | |
benchDeserializeJSON I9 P1 [μ Mo]/r: 0.447 0.410 (μs) [μSD μRSD]/r: 0.107μs 23.81% | |
benchSerializeNative I9 P0 [μ Mo]/r: 0.221 0.218 (μs) [μSD μRSD]/r: 0.009μs 4.18% | |
benchSerializeNative I9 P1 [μ Mo]/r: 0.221 0.218 (μs) [μSD μRSD]/r: 0.009μs 4.21% | |
benchDeserializeNative I9 P0 [μ Mo]/r: 0.441 0.431 (μs) [μSD μRSD]/r: 0.019μs 4.31% | |
benchDeserializeNative I9 P1 [μ Mo]/r: 0.441 0.430 (μs) [μSD μRSD]/r: 0.019μs 4.26% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
queue = require('queue') | |
local function start(config) | |
box.once('jobserver:v0.1.0', function() | |
local tube = queue.create_tube('default', 'fifottl', {if_not_exists = true}) | |
end) | |
end | |
local function stop() | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php -r '$exif=@exif_read_data("lc-bad-exif.jpg");print_r($exif);' > exif_read_data.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sapi/cli/php Zend/bench.php | |
------------------------ | |
Total 0.497 | |
$ sapi/cli/php -dextension_dir=`pwd`/modules -dzend_extension=opcache.so Zend/bench.php | |
------------------------ | |
Total 0.488 | |
$ sapi/cli/php -dextension_dir=`pwd`/modules -dzend_extension=opcache.so -dopcache.enable_cli=1 -dopcache.file_update_protection=0 -dopcache.jit_buffer_size=1M Zend/bench.php | |
------------------------ |