From: divinity76 Date: Tue, 27 Oct 2020 15:19:58 +0000 (+0100) Subject: Use constant size string in hash bench.php X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c71d3476b695a92377505f2fd19ddc97418ef94;p=php 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] --- diff --git a/ext/hash/bench.php b/ext/hash/bench.php index 7a0bc4ff54..846163315b 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;