分享:针对头条(你敢相信go在运行效率比php快20多倍探讨go语言发展潜力)后续测试,
博主头条号:go的慢慢学习路
博主原文地址:
PHP测试脚本:
<?php
/**
* Created by PhpStorm.
* User: 835173372@qq.com
* NickName: 老孟编程
* Date: 2020/4/14 0014
* Time: 8:18
*/
set_time_limit(0);
$now = time();
for ($a = 0; $a <= 1000; $a++) {
for ($b = 0; $b <= 1000; $b++) {
for ($c = 0; $c <= 1000; $c++) {
if ($a + $b + $c === 1000 && $a * $a + $b * $b == $c * $c) {
echo $a, '-';
echo $b, '-';
echo $c, '-';
}
}
}
}
$end = time() - $now;
echo '---------耗时时间----------', PHP_EOL;
echo $end,'秒', PHP_EOL;
Go在运行效率比PHP快20多倍!
window环境,硬件配置4核16g,
php版本7.2.1
linux环境下,硬件配置2核4g
php版本7.4.3
php7以上的版本差距不是太明显,测试的不是很严谨,需要有爱好的同好详细评测
博主-go的慢慢学习之路已经评测过go在windows下的运行速度,大约2-3秒之间,博主最好显示一下硬件配置,硬件对执行效率影响很致命。
学习建议:资深PHP程序员建议花个1个月时间熟悉一下go语法,然后找个go框架做个项目基本就上手了,如果是资深的go开发的话,没有必要学习PHP了,配合python是更好技能包,这种现象是符合现阶段情况的。
当然了,作为一个PHP开发的拥趸,还是希望PHP8.0的性能能再有本质的飞跃!
naturally like your web-site but you need
to take a look at the spelling on quite a few of your posts.
A number of them are rife with spelling issues and I to
find it very troublesome to inform the truth nevertheless I will surely
come back again.
I used to be able to find good information from
your blog articles.