Сообщение от moro
|
тестовый код давайте, сделаю
|
вот, генератор двух одинаковых тестовых кодов
<?
$fp1=fopen('test.php','w');
$fp2=fopen('test.js','w');
fwrite($fp1,"<?\r\n");
fwrite($fp1,"list(\$usec, \$seconds) = explode(\" \", microtime());\r\n");
fwrite($fp1,"\$start = ((float)\$usec + (float)\$seconds);\r\n");
fwrite($fp2,"sys = require('sys');\r\n");
fwrite($fp2,"var start = Date.now();\r\n");
$op=array('+','-','*','/','%');
for($i=97;$i<=122;$i++)
{
fwrite($fp1,'$'.chr(rand(97,122))."=0;\r\n");
fwrite($fp2,'var '.chr(rand(97,122))."=0;\r\n");
}
$string='$'.chr(rand(97,122)).'='.'$'.chr(rand(97,122)).$op[array_rand($op)].rand(1,1000000).";\r\n";
for($i=0;$i<1000000;$i++)
{
$a=chr(rand(97,122));
$b=chr(rand(97,122));
$c=$op[array_rand($op)];
$d=rand(1,1000000).'.'.rand(1,10000);
$string='$'.$a.'='.'$'.$b.$c.$d.";\r\n";
fwrite($fp1,$string);
$string=$a.'='.$b.$c.$d.";\r\n";
fwrite($fp2,$string);
}
fwrite($fp1,"list(\$usec, \$seconds) = explode(\" \", microtime());\r\n");
fwrite($fp1,"\$end = ((float)\$usec + (float)\$seconds);\r\n");
fwrite($fp1,"echo \$end - \$start;");
fwrite($fp1,"?>");
fwrite($fp2,"sys.puts((Date.now() - start)/1000);\r\n");
?>