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 | |
// @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
empty_loop 0.076 | |
unpack_i16 2.097 2.021 | |
ord_i16 0.925 0.849 | |
unpack_u16 2.051 1.975 | |
ord_u16 0.740 0.664 | |
------------------------ | |
Total 5.889 | |
php -v | |
PHP 7.0.5 (cli) (built: Apr 23 2016 10:48:01) ( NTS ) |
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 | |
// Borrowed from https://gist.github.com/denji/7c3c9d4b449f2699ec73 | |
require __DIR__.'/../vendor/autoload.php'; | |
ini_set("display_errors", 1); | |
ini_set("display_startup_errors", 1); | |
ini_set("error_reporting", E_ALL); |
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 | |
use App\MessagePack\PackedMap; | |
use App\MessagePack\PackedMapTransformer; | |
use MessagePack\BufferUnpacker; | |
use MessagePack\Packer; | |
use MessagePack\PackOptions; | |
require __DIR__.'/vendor/autoload.php'; |
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
$ MP_BENCH_DURATION=.01 MP_BENCH_TARGETS=pure_p,pure_u,json_p,json_u php tests/bench_json.php | |
Filter: MessagePack\Tests\Perf\Filter\NameFilter | |
Rounds: 3 | |
Duration: .01 | |
============================================================================================== | |
Test/Target MessagePack\Packer MessagePack\BufferUnpacker json_encode json_decode | |
---------------------------------------------------------------------------------------------- | |
nil ......................... 39820.0000 ................ 24967.0000 . 65322.3333 . 55244.3333 | |
false ....................... 38231.0000 ................ 24824.6667 . 63387.6667 . 56517.0000 |
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 | |
use Buzz\Listener\ListenerInterface; | |
use Buzz\Message\MessageInterface; | |
use Buzz\Message\RequestInterface; | |
class JsonListener implements ListenerInterface | |
{ | |
/** | |
* {@inheritdoc} |
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 | |
for ($i = 0; $i < 1000000; ++$i) { | |
$server = $_SERVER; | |
$server += array( | |
'SERVER_NAME' => 'localhost', | |
'SERVER_PORT' => 80, | |
'HTTP_HOST' => 'localhost', | |
'HTTP_USER_AGENT' => 'Symfony/2.X', | |
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', |
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 | |
namespace Acme\Validator\Constraints; | |
use Symfony\Component\Validator\Constraint; | |
use Symfony\Component\Validator\Constraints\Valid; | |
use Symfony\Component\Validator\Exception\ConstraintDefinitionException; | |
/** | |
* @Annotation |
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 | |
// Twig/AcmeExtension.php | |
namespace Acme\DemoBundle\Twig\Extension; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
class AcmeExtension extends \Twig_Extension | |
{ | |
private $container; |