From 0e7c97ab633aca17a8d18d5e8d12400c995c042d Mon Sep 17 00:00:00 2001 From: Mika Tuupola Date: Sat, 7 May 2016 20:42:33 +0700 Subject: [PATCH] Add PHPBench benchmarks --- benchmarks/Base62Bench.php | 46 ++++++++++++++++++++++++++++++++++++++ phpbench.json | 10 +++++++++ 2 files changed, 56 insertions(+) create mode 100644 benchmarks/Base62Bench.php create mode 100644 phpbench.json diff --git a/benchmarks/Base62Bench.php b/benchmarks/Base62Bench.php new file mode 100644 index 0000000..8a1ac20 --- /dev/null +++ b/benchmarks/Base62Bench.php @@ -0,0 +1,46 @@ +data = random_bytes(128); + } + + /** + * @Revs(10) + */ + public function benchGmpEncoder() + { + $encoded = GmpEncoder::encode($this->data); + $decoded = GmpEncoder::decode($encoded); + } + + /** + * @Revs(10) + */ + public function benchPhpEncoder() + { + $encoded = PhpEncoder::encode($this->data); + $decoded = PhpEncoder::decode($encoded); + } + + /** + * @Revs(10) + */ + public function benchBcmathEncoder() + { + $encoded = BcmathEncoder::encode($this->data); + $decoded = BcmathEncoder::decode($encoded); + } +} \ No newline at end of file diff --git a/phpbench.json b/phpbench.json new file mode 100644 index 0000000..b634933 --- /dev/null +++ b/phpbench.json @@ -0,0 +1,10 @@ +{ + "bootstrap": "vendor/autoload.php", + "reports": { + "default": { + "generator": "table", + "cols": [ "subject", "mean", "diff" ], + "break": ["benchmark"] + } + } +}