Skip to content

Instantly share code, notes, and snippets.

@Ocramius
Last active April 21, 2016 20:05
Show Gist options
  • Save Ocramius/d4b34ece4f80b99735d3 to your computer and use it in GitHub Desktop.
Save Ocramius/d4b34ece4f80b99735d3 to your computer and use it in GitHub Desktop.
Benchmarking type-hinted variadic arguments versus looping+checking values
vendor
composer.phar
<?php
namespace VariadicArgsBench;
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;
/**
* @Revs(10000)
* @Iterations(10)
* @Warmup(2)
*/
class ArrayTypeCheckBench
{
/**
* @var callable
*/
private $loopFunction;
/**
* @var callable
*/
private $variadicFunction;
public function __construct()
{
$this->loopFunction = function (array $items) {
foreach ($items as $item) {
if (! $item instanceof \stdClass) {
throw new \InvalidArgumentException('Not an stdClass!');
}
}
return $items;
};
$this->variadicFunction = function (\stdClass ...$items) {
return $items;
};
$this->items1 = array_fill(0, 2, new \stdClass());
$this->items2 = array_fill(0, 100, new \stdClass());
$this->items3 = array_fill(0, 1000, new \stdClass());
$this->items4 = array_fill(0, 1000, new \stdClass());
}
public function benchLoop1()
{
\call_user_func($this->loopFunction, $this->items1);
}
public function benchVariadic1()
{
\call_user_func_array($this->variadicFunction, $this->items1);
}
public function benchLoop2()
{
\call_user_func($this->loopFunction, $this->items2);
}
public function benchVariadic2()
{
\call_user_func_array($this->variadicFunction, $this->items2);
}
public function benchLoop3()
{
\call_user_func($this->loopFunction, $this->items3);
}
public function benchVariadic3()
{
\call_user_func_array($this->variadicFunction, $this->items3);
}
public function benchLoop4()
{
\call_user_func($this->loopFunction, $this->items4);
}
public function benchVariadic4()
{
\call_user_func_array($this->variadicFunction, $this->items4);
}
}
{
"require": {
"php": "^5.6 || ^7.0",
"phpbench/phpbench": "^0.10.0"
},
"autoload": {
"classmap": [
"ArrayTypeCheckBench.php"
]
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "2f96adf6c7004711f7fe844f84e354e3",
"content-hash": "4ba7306a382ab30eb08823786c854e7f",
"packages": [
{
"name": "doctrine/annotations",
"version": "v1.2.7",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
"reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/cache": "1.*",
"phpunit/phpunit": "4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Annotations\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
],
"time": "2015-08-31 12:32:49"
},
{
"name": "doctrine/lexer",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Lexer\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"lexer",
"parser"
],
"time": "2014-09-09 13:34:57"
},
{
"name": "justinrainbow/json-schema",
"version": "1.4.4",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
"reference": "8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce",
"reference": "8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"json-schema/json-schema-test-suite": "1.1.0",
"phpdocumentor/phpdocumentor": "~2",
"phpunit/phpunit": "~3.7"
},
"bin": [
"bin/validate-json"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"JsonSchema": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Bruno Prieto Reis",
"email": "bruno.p.reis@gmail.com"
},
{
"name": "Justin Rainbow",
"email": "justin.rainbow@gmail.com"
},
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
},
{
"name": "Robert Schönthal",
"email": "seroscho@googlemail.com"
}
],
"description": "A library to validate a json schema.",
"homepage": "https://github.com/justinrainbow/json-schema",
"keywords": [
"json",
"schema"
],
"time": "2015-07-14 16:29:50"
},
{
"name": "phpbench/dom",
"version": "0.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpbench/dom.git",
"reference": "320ecff2f219a9189b33ff3ca6c5d12c54307173"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpbench/dom/zipball/320ecff2f219a9189b33ff3ca6c5d12c54307173",
"reference": "320ecff2f219a9189b33ff3ca6c5d12c54307173",
"shasum": ""
},
"require": {
"ext-dom": "*",
"php": "^5.4|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"PhpBench\\Dom\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniel Leech",
"email": "daniel@dantleech.com"
}
],
"description": "DOM wrapper to simplify working with the PHP DOM implementation",
"time": "2015-11-25 10:33:16"
},
{
"name": "phpbench/phpbench",
"version": "0.10.0",
"source": {
"type": "git",
"url": "https://github.com/phpbench/phpbench.git",
"reference": "4b1c4114e483a41b36776d50d88f58da5aea6321"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpbench/phpbench/zipball/4b1c4114e483a41b36776d50d88f58da5aea6321",
"reference": "4b1c4114e483a41b36776d50d88f58da5aea6321",
"shasum": ""
},
"require": {
"doctrine/annotations": "^1.2.7",
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"justinrainbow/json-schema": "^1.0",
"php": "^5.4|^7.0",
"phpbench/dom": "^0.1",
"phpbench/tabular": "^0.4.1",
"seld/jsonlint": "^1.0",
"symfony/console": "^2.4|^3.0",
"symfony/debug": "^2.4|^3.0",
"symfony/filesystem": "^2.4|^3.0",
"symfony/finder": "^2.4|^3.0",
"symfony/process": "^2.1|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"bin": [
"bin/phpbench"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"PhpBench\\": "lib/",
"PhpBench\\Extensions\\XDebug\\": "extensions/xdebug/lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniel Leech",
"email": "daniel@dantleech.com"
}
],
"description": "PHP Benchmarking Framework",
"time": "2016-01-16 10:16:42"
},
{
"name": "phpbench/tabular",
"version": "0.4.1",
"source": {
"type": "git",
"url": "https://github.com/phpbench/tabular.git",
"reference": "16f6feefc449153ed2bf6a89777cf1b488b34d53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpbench/tabular/zipball/16f6feefc449153ed2bf6a89777cf1b488b34d53",
"reference": "16f6feefc449153ed2bf6a89777cf1b488b34d53",
"shasum": ""
},
"require": {
"justinrainbow/json-schema": "~1.4.0",
"php": "~5.4|^7.0",
"phpbench/dom": "~0.1",
"seld/jsonlint": "~1.0"
},
"bin": [
"bin/phpbench"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"PhpBench\\Tabular\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniel Leech",
"email": "daniel@dantleech.com"
}
],
"description": "Generate complex tables from simple configuration",
"time": "2015-12-27 10:59:20"
},
{
"name": "psr/log",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2012-12-21 11:40:51"
},
{
"name": "seld/jsonlint",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/jsonlint.git",
"reference": "66834d3e3566bb5798db7294619388786ae99394"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394",
"reference": "66834d3e3566bb5798db7294619388786ae99394",
"shasum": ""
},
"require": {
"php": "^5.3 || ^7.0"
},
"bin": [
"bin/jsonlint"
],
"type": "library",
"autoload": {
"psr-4": {
"Seld\\JsonLint\\": "src/Seld/JsonLint/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "JSON Linter",
"keywords": [
"json",
"linter",
"parser",
"validator"
],
"time": "2015-11-21 02:21:41"
},
{
"name": "symfony/console",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0",
"reference": "5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/event-dispatcher": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2016-02-02 13:44:19"
},
{
"name": "symfony/debug",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "29606049ced1ec715475f88d1bbe587252a3476e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/29606049ced1ec715475f88d1bbe587252a3476e",
"reference": "29606049ced1ec715475f88d1bbe587252a3476e",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/class-loader": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2016-01-27 05:14:46"
},
{
"name": "symfony/filesystem",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "064ac12afd2ceb8a2c1bfb7bed8e931c6dd1997f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/064ac12afd2ceb8a2c1bfb7bed8e931c6dd1997f",
"reference": "064ac12afd2ceb8a2c1bfb7bed8e931c6dd1997f",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2016-01-27 11:34:55"
},
{
"name": "symfony/finder",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "623bda0abd9aa29e529c8e9c08b3b84171914723"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/623bda0abd9aa29e529c8e9c08b3b84171914723",
"reference": "623bda0abd9aa29e529c8e9c08b3b84171914723",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2016-01-27 05:14:46"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "1289d16209491b584839022f29257ad859b8532d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d",
"reference": "1289d16209491b584839022f29257ad859b8532d",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2016-01-20 09:13:37"
},
{
"name": "symfony/process",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "dfecef47506179db2501430e732adbf3793099c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/dfecef47506179db2501430e732adbf3793099c8",
"reference": "dfecef47506179db2501430e732adbf3793099c8",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2016-02-02 13:44:19"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^5.6 || ^7.0"
},
"platform-dev": []
}
PhpBench 0.10.0. Running benchmarks.
Using configuration file: phpbench.json
VariadicArgsBench\ArrayTypeCheckBench
benchLoop1 I9 P0 [μ Mo]/r: 2.021 1.919 (μs) [μSD μRSD]/r: 0.148μs 7.34%
benchLoop1 R6 I7 P0 [μ Mo]/r: 1.986 1.936 (μs) [μSD μRSD]/r: 0.095μs 4.81%
benchLoop1 R2 I7 P0 [μ Mo]/r: 1.938 1.933 (μs) [μSD μRSD]/r: 0.046μs 2.39%
benchVariadic1 R2 I9 P0 [μ Mo]/r: 2.043 2.156 (μs) [μSD μRSD]/r: 0.167μs 8.18%
benchVariadic1 R7 I9 P0 [μ Mo]/r: 1.914 1.793 (μs) [μSD μRSD]/r: 0.163μs 8.53%
benchVariadic1 R8 I8 P0 [μ Mo]/r: 1.895 1.858 (μs) [μSD μRSD]/r: 0.105μs 5.53%
benchVariadic1 R4 I8 P0 [μ Mo]/r: 1.934 1.895 (μs) [μSD μRSD]/r: 0.099μs 5.12%
benchVariadic1 R4 I9 P0 [μ Mo]/r: 1.890 1.912 (μs) [μSD μRSD]/r: 0.072μs 3.81%
benchVariadic1 R3 I9 P0 [μ Mo]/r: 1.878 1.899 (μs) [μSD μRSD]/r: 0.063μs 3.35%
benchVariadic1 R3 I9 P0 [μ Mo]/r: 1.937 1.903 (μs) [μSD μRSD]/r: 0.084μs 4.31%
benchVariadic1 R1 I9 P0 [μ Mo]/r: 1.913 1.907 (μs) [μSD μRSD]/r: 0.044μs 2.31%
benchVariadic1 R1 I6 P0 [μ Mo]/r: 1.905 1.915 (μs) [μSD μRSD]/r: 0.029μs 1.51%
benchLoop2 R1 I9 P0 [μ Mo]/r: 7.948 7.778 (μs) [μSD μRSD]/r: 0.432μs 5.43%
benchLoop2 R5 I7 P0 [μ Mo]/r: 7.819 7.810 (μs) [μSD μRSD]/r: 0.216μs 2.76%
benchLoop2 R1 I4 P0 [μ Mo]/r: 7.767 7.828 (μs) [μSD μRSD]/r: 0.131μs 1.69%
benchVariadic2 R1 I9 P0 [μ Mo]/r: 3.402 3.472 (μs) [μSD μRSD]/r: 0.142μs 4.18%
benchVariadic2 R3 I8 P0 [μ Mo]/r: 3.430 3.454 (μs) [μSD μRSD]/r: 0.097μs 2.84%
benchVariadic2 R1 I0 P0 [μ Mo]/r: 3.431 3.454 (μs) [μSD μRSD]/r: 0.096μs 2.79%
benchLoop3 R1 I9 P0 [μ Mo]/r: 61.020 61.301 (μs) [μSD μRSD]/r: 0.946μs 1.55%
benchVariadic3 R1 I9 P0 [μ Mo]/r: 17.814 17.707 (μs) [μSD μRSD]/r: 0.278μs 1.56%
benchLoop4 R1 I9 P0 [μ Mo]/r: 61.313 61.773 (μs) [μSD μRSD]/r: 1.095μs 1.79%
benchVariadic4 R1 I9 P0 [μ Mo]/r: 18.005 18.104 (μs) [μSD μRSD]/r: 0.430μs 2.39%
8 subjects, 80 iterations, 800000 revs, 49 rejects
(best [mean mode] worst) = 1.852 [21.649 7.095] 62.742 (μs)
⅀T: 17,319,276.000μs μSD/r 0.381μs μRSD/r: 1.957%
+---------------------+----------------+-------+--------+-------+-----+----------+----------+----------+----------+----------+---------+--------+------------+
| benchmark | subject | group | params | revs | its | mem | best | mean | mode | worst | stdev | rstdev | diff |
+---------------------+----------------+-------+--------+-------+-----+----------+----------+----------+----------+----------+---------+--------+------------+
| ArrayTypeCheckBench | benchLoop1 | | [] | 10000 | 10 | 892,416b | 1.871μs | 1.938μs | 1.933μs | 2.032μs | 0.046μs | 2.39% | +1.71% |
| ArrayTypeCheckBench | benchVariadic1 | | [] | 10000 | 10 | 892,416b | 1.852μs | 1.905μs | 1.915μs | 1.940μs | 0.029μs | 1.51% | 0.00% |
| ArrayTypeCheckBench | benchLoop2 | | [] | 10000 | 10 | 892,416b | 7.461μs | 7.767μs | 7.828μs | 7.916μs | 0.131μs | 1.69% | +307.68% |
| ArrayTypeCheckBench | benchVariadic2 | | [] | 10000 | 10 | 892,416b | 3.263μs | 3.431μs | 3.454μs | 3.572μs | 0.096μs | 2.79% | +80.07% |
| ArrayTypeCheckBench | benchLoop3 | | [] | 10000 | 10 | 892,416b | 59.509μs | 61.020μs | 61.301μs | 62.444μs | 0.946μs | 1.55% | +3,102.71% |
| ArrayTypeCheckBench | benchVariadic3 | | [] | 10000 | 10 | 892,416b | 17.452μs | 17.814μs | 17.707μs | 18.423μs | 0.278μs | 1.56% | +834.97% |
| ArrayTypeCheckBench | benchLoop4 | | [] | 10000 | 10 | 892,416b | 58.875μs | 61.313μs | 61.773μs | 62.742μs | 1.095μs | 1.79% | +3,118.08% |
| ArrayTypeCheckBench | benchVariadic4 | | [] | 10000 | 10 | 892,416b | 17.417μs | 18.005μs | 18.104μs | 18.832μs | 0.430μs | 2.39% | +845.02% |
+---------------------+----------------+-------+--------+-------+-----+----------+----------+----------+----------+----------+---------+--------+------------+
{
"bootstrap": "vendor/autoload.php",
"path": ".",
"retry_threshold": 5
}
#!/bin/sh
set -x
curl -sS https://getcomposer.org/installer | php
./composer.phar install
./vendor/bin/phpbench run --report=aggregate ArrayTypeCheckBench.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment