Comparison of cumulative summation test results: Program: Python PHP5 PHP7
Time: 10.057s 3.855s 1.855s
Memory:
3.039g8.9m 12.5m
python memory consumption up to 3GB, what is the situation?
Conclusion: Both Python and PHP are dynamic scripting languages, and there is no JIT mechanism, so testing is fair.
Python computing performance is not as good as PHP5, with PHP7 gap is bigger, so the future will not black PHP calculation is not as good as python.
The following is a detailed test procedure:
python bubble sort: def bubble_sort (LST):
length = Len (LST)
For I in range (0, length, 1):
For j in range (0, length-1, 1):
If LST[J] < lst[j+1]:
temp = Lst[j]
LST[J] = lst[j+1]
LST[J+1] = Temp
return LST
For C in range (1000000):
LST = [0,1,2,3,4,5,6,7,8,9]
LST = Bubble_sort (LST)
Print (LST)
Test: Time Python bubblesort.py
Time: 0m16.910s
Memory: 35.8m
Python summation: sum = 0
For I in Range (100000000):
sum + = i
Print (sum)
Test: Time Python sum.py
Time: 0m10.057s
Memory: 3.039g
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.