日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

C/C++、JAVA、Python简单运行速度实验与分析

發布時間:2024/10/5 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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简单运行速度实验与分析的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。