php7 run
程序员文章站
2022-05-06 12:17:24
...
/**
* test.php ; compare php5.6.7 with php7.0.0alphal on time and memory by this simple program
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
$memory_start = memory_get_usage();
echo "Time start $time_start\n";
echo "Memory start $memory_start\n";
// Sleep for a while
//usleep(100);
$sum = 0;
for($i=1; $i {
$sum+=$i;
}
$i--;
echo "Sum(1+2+3+...+$i) = $sum\n";
$time_end = microtime_float();
$memory_end = memory_get_usage();
echo "Time end $time_end\n";
echo "Memory end $memory_end\n";
$time = $time_end - $time_start;
$memory = $memory_end - $memory_start;
//echo "Did nothing in $time seconds\n";
echo "Sub time $time seconds\n";
echo "Sub momory $memory byte\n";
?>
* test.php ; compare php5.6.7 with php7.0.0alphal on time and memory by this simple program
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
$memory_start = memory_get_usage();
echo "Time start $time_start\n";
echo "Memory start $memory_start\n";
// Sleep for a while
//usleep(100);
$sum = 0;
for($i=1; $i {
$sum+=$i;
}
$i--;
echo "Sum(1+2+3+...+$i) = $sum\n";
$time_end = microtime_float();
$memory_end = memory_get_usage();
echo "Time end $time_end\n";
echo "Memory end $memory_end\n";
$time = $time_end - $time_start;
$memory = $memory_end - $memory_start;
//echo "Did nothing in $time seconds\n";
echo "Sub time $time seconds\n";
echo "Sub momory $memory byte\n";
?>
上一篇: 使用mysqlbinlog提取二进制日志_MySQL
下一篇: 无法访问静态页面的疑问
推荐阅读
-
centos安装php5、卸载php、安装php7
-
Linux下如何安装Run文件格式NVIDIA显卡驱动
-
PHP7新建扩展
-
解决idea 拉取代码出现的 “ Сannot Run Git Cannot identify version of git executable: no response“的问题
-
ThinkPHP中SHOW_RUN_TIME不能正常显示运行时间的解决方法 原创,thinkphprun_PHP教程
-
牛客网暑期ACM多校训练营(第二场)A run [简单计数dp]
-
cannot run program "git.exe":CreateProcess
-
Run Dashboard的特质
-
ECshop 迁移到 PHP7版本时遇到的兼容性问题_PHP
-
PHP7 中不要做的 10 件事