C/C++、JAVA、Python简单运行速度实验与分析
生活随笔
收集整理的這篇文章主要介紹了
C/C++、JAVA、Python简单运行速度实验与分析
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
C/C++
/* *@Author: STZG *@Language: C++ */ #include <bits/stdc++.h> using namespace std; int main() {int count=0;for(int i=1;i<=1e7;i++)count++;printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);return 0; }運行時間:0.012000s?
JAVA
public class Main {public static void main(String[] args) {long startTime=System.currentTimeMillis();int count=0;for(int i=1;i<=1e7;i++)count++;long endTime=System.currentTimeMillis();System.out.println("程序運行時間: "+(endTime - startTime)+"ms");}}運行時間:0.011000s
Python
import time start=time.perf_counter() count=1 for i in range(10000000):count+1 end=time.perf_counter() print(end-start)運行時間:0.531215s?
分析
?
?
參考文章
https://blog.csdn.net/qq_36868342/article/details/82838041
https://www.cnblogs.com/nucdy/p/6703780.html
http://baijiahao.baidu.com/s?id=1586231401218732290&wfr=spider&for=pc
https://blog.csdn.net/csdnnews/article/details/81213229
總結
以上是生活随笔為你收集整理的C/C++、JAVA、Python简单运行速度实验与分析的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux——主流发行版本
- 下一篇: C++——赫夫曼编码-译码器(Huffm