com php-src: Use constant size string in hash bench.php: ext/hash/bench.php
| From: | Nikita Popov | Date: | Fri, 30 Oct 2020 08:54:48 +0000 |
| Subject: | com php-src: Use constant size string in hash bench.php: ext/hash/bench.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-113990@lists.php.net to get a copy of this message | ||
Commit: 6c71d3476b695a92377505f2fd19ddc97418ef94
Author: divinity76 <divinity76@gmail.com> Tue, 27 Oct 2020 16:19:58 +0100
Committer: Nikita Popov <nikita.ppv@gmail.com> Fri, 30 Oct 2020 09:54:48 +0100
Parents: dd008fd1249dc63b2b98f695f154ba32f0134fff
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6c71d3476b695a92377505f2fd19ddc97418ef94
Log:
Use constant size string in hash bench.php
I don't like the previous behaviour where the bytes to hash change
every time the code changes, that may make it difficult to compare
hash() performance changes over time.
Use a fixed number instead, and allow passing an override for a
different length.
Closes GH-6386.
[ci skip]
Changed paths:
M ext/hash/bench.php
Diff:
diff --git a/ext/hash/bench.php b/ext/hash/bench.php
index 7a0bc4ff540..846163315b8 100755
--- a/ext/hash/bench.php
+++ b/ext/hash/bench.php
@@ -3,7 +3,7 @@
error_reporting(E_ALL);
-$data = file_get_contents(__FILE__);
+$data = str_repeat("\x00", (int) ($argv[1] ?? (2 * 1024)));
$time = array();
foreach (hash_algos() as $algo) {
$time[$algo] = 0;