Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ext/hash/bench.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

error_reporting(E_ALL);

$data = file_get_contents(__FILE__);
// 2240 comes from the fact that it used to be file_get_contents(__FILE__);
$data = str_repeat("\x00", 2240);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been constant before, too?

Copy link
Contributor Author

@divinity76 divinity76 Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m6w6 not exactly.
in revision 7a08865 it was 1949 bytes.
in revision 8d3f8ca it was 1938 bytes.
in revision 02294f0 it was 1957 bytes.
in revision 58b1790 it was 2178 bytes
in revision 3d1e7d3 it was 2240 bytes
, and in the current revision it's 503 bytes.. ( e0ea3e8 )
a 77% reduction in bytes to hash in the last revision,

with such fluctation in the number of bytes to hash, benchmarks like this may no longer reproduce: #6358 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any point in preserving the exact previous size. Let's make this a nice round number like 2048. Could also make it $argv[1] ?? 2048 to allow passing a different size :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikic sounds good to me, how about e213df9

$time = array();
foreach (hash_algos() as $algo) {
$time[$algo] = 0;
Expand Down