Skip to content

Instantly share code, notes, and snippets.

@ao
Created August 21, 2014 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ao/8df01d879bcd0c368576 to your computer and use it in GitHub Desktop.
Save ao/8df01d879bcd0c368576 to your computer and use it in GitHub Desktop.
crc32test.php - Calculate crc32 loss
<?php
ini_set('memory_limit', '16000M');
$arrays = array();
$total = 50000000;
for ($i=0; $i<$total; $i++) {
$arrays[crc32($i)] = '';
}
echo $total."\n";
echo count($arrays);
echo "\n";
?>
php crc32test.php
-50000000
-49727616
=0.544768%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment