00001 <?php
00002 include '../lookups/cars.php';
00003 include '../lookups/rules.php';
00004 include '../lookups/tracks.php';
00005 include '../utilities/bitstoarray.php';
00006
00007 $test = 364857;
00008 $nTest = '';
00009 $tla = PPFCars::getLookupArray('bits', 'words');
00010 $s = microtime(true);
00011 for($i=0; $i<10000; $i++)
00012 {
00013 $nTest = '';
00014 $tx = bitsToArray($test);
00015 foreach($tx as $t)
00016 $nTest .= $tla[$t];
00017 }
00018 $e = microtime(true);
00019 echo "<p>$nTest</p><p>".($e-$s)."</p>";
00020
00021
00022
00023
00024 $cars[0] = 57;
00025 $cars[1] = 145;
00026 $cars[2] = 5;
00027 $test = strrev(str_pad(decbin($cars[2]), 8, '0', STR__PAD_LEFT).
00028 str_pad(decbin($cars[1]), 8, '0', STR__PAD_LEFT).
00029 str_pad(decbin($cars[0]), 8, '0', STR__PAD_LEFT));
00030 $nTest = '';
00031 $tla = PPFCars::getLookupArray('zbi', 'words');
00032 $s = microtime(true);
00033 for($i=0; $i<10000; $i++)
00034 {
00035 $nTest = '';
00036 $j=-1;
00037 while(isset($test[++$j]))
00038 {
00039 if($test[$j] === '1')
00040 $nTest .= $tla[$j];
00041 }
00042 }
00043 $e = microtime(true);
00044 echo "<p>$nTest</p><p>".($e-$s)."</p>";
00045
00046
00047
00048 ?>