update($chunk); $i++; $now = microtime(true); $duration = ($now - $start); if ($duration >= max_duration) { break; } if ($duration >= min_duration && $i >= min_iterations) { break; } } // Very quick sanity check if ($crc->hash() == '00000000') { exit($name . ' crc check failed'); } $bytes = $i * $chunk_size; echo sprintf("%s\t%10d\t%5d\t%8.2f MB/s\n", $name, $chunk_size, $i, $bytes / ($now - $start) / 1000000); } foreach (array(256, 4096, 1048576, 16777216) as $chunk_size) { test(new PHP(CRC32::CASTAGNOLI), $chunk_size); test(new PHPSlicedBy4(CRC32::CASTAGNOLI), $chunk_size); // Using IEEE, avoiding the CASTAGNOLI version crc32c.so adds. test(new Builtin(CRC32::IEEE), $chunk_size); test(new Google(), $chunk_size); }