先贴代码
#include <stdio.h> void main(void) { int count=0,b; while(count < 2+100000000){ b=count; count++; } printf("Good bye!"); }
故意多了个运算
gcc t.c -o tc
gcc -O2 t.c -o tc2
#!/usr/bin/python count = 0 while (count < 100000000): b = count count = count + 1 print "Good bye!"
#!/usr/bin/php <?php $count=0; while ($count < 100000000){ $b=$count; $count++; } echo "Good bye!";
执行对比结果
[root@qxeden tmp]# time ./tc Good bye! real 0m0.376s user 0m0.376s sys 0m0.000s [root@qxeden tmp]# time ./tc2 Good bye! real 0m0.002s user 0m0.000s sys 0m0.002s [root@qxeden tmp]# time ./t.py Good bye! real 0m23.721s user 0m23.702s sys 0m0.007s [root@qxeden tmp]# time ./t.php Good bye! real 0m2.122s user 0m2.111s sys 0m0.010s PHP5.6.31 补充 time ./t56.php Good bye! real 0m7.599s user 0m7.583s sys 0m0.013s
补充版本信息
[root@qxeden tmp]# gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [root@qxeden tmp]# php --version PHP 7.1.9 (cli) (built: Aug 30 2017 20:06:08) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies [root@qxeden tmp]# python --version Python 2.7.5
相关推荐
A while-loop with multiple conditions. while_loop_multiple_conditions.py Looping through the wizard list. wizard_list_loop.py Chapter 7 A function to calculate your savings. savings.py Building a ...
如果想要强行转换变量类型,可以使用与C语言相同的函数settype()。 2.5 变量与常量 可能你已经注意到,变量都有一个美元符号($)的前缀。所有变量都是局部变量,为了使得定义的函数中可以使用外部变量,使用...
包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用...
Since 2017, he's freelancing, trying to work on open source projects in TypeScript, PHP, Dart, C, and Python. He's been actively contributing to RxPHP and RxJS 5 on both Github and StackOverflow. He ...
包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用...
You'll learn about SQLite extensions available for C, Java, Perl, PHP, Python, Ruby, and Tcl., The book thoroughly covers SQLite internals to help you take full advantage of its features while ...
Since the late 1980s and early 1990s, there has been a slow ood of powerful new languages and paradigms—Perl, Python, Ruby, PHP, and JavaScript—have taken an expanding user base by storm and has ...
In these books, the examples are solved in various languages like Go, C, C++, Java, C#, Python, VB, JavaScript and PHP. This book introduces you to the world of data structures and algorithms. Data ...
第1篇 Linux下C语言基础 第1章 Linux简介 1.1 GNU简介 1.2 Linux简介 1.2.1 Linux发展史 1.2.2 Linux发行版 1.2.3 Linux内核版本 1.2.4 Linux与UNIX的关系 1.2.5 Linux在服务器方面的发展 1.2.6 Linux在嵌入式系统...
Lucene in Action 英文版 JAVA 组件 Lucene is a powerful Java search library that lets you easily add search to any...integrations to other programming languages (C/C++, C#, Ruby, Perl, Python, PHP, etc.).
包括以下基本功能:语法高亮显示,代码折叠,代码自动补完,自动补完经常使用的结构(如:if、for、while 等),自动补完 XML 和 HTML 标记(tag),调用提示,支持 C、Java、PHP、HTML、Python、Perl、Pascal 等...
while (*ptr) { 趋向 ] } T_PRT . putchar(*ptr); T_INP , ptr[0] = getchar(); 此存储库中有多个BF解释器和工具。 BF程序“ bitwidth.b”; 如果您的口译员正确执行了此操作,那么这很可能会很容易。 ...
用多种编程语言编写了两个性能测试,并比较了它们的计算速度。 循环测试 该测试评估了带有 while 子句的变量迭代的简单循环中的代码速度。 def cycle ( n ): i = 0 while i < n : i += 1 河内测试 测试扩展递归以...