Click here to Skip to main content
15,885,953 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Do not speak English well. Please note.
I have a simple test.

OS: Windows7 32bit

# test.py
SQL
import time

if __name__ == '__main__':
    stratTime = time.time()
    f = open("D:\test.log", 'r')
    w = open("temp.txt", 'a');

    while True:
        line = f.readline()
        if not line: break
        temp = line.split('-')
        w.write(temp[1])

    f.close()
    w.close()

    print time.time() - stratTime


test.log is BigFile.
The line number of test.log is 1487573

SimpleTest Result
Python2.7: 3.5
Python3.3: 9.1

Why the above results?
Posted
Updated 20-May-15 19:15pm
v2
Comments
Mohibur Rashid 21-May-15 1:19am    
You should do the same test multiple time.
Then make an average and decide.
Member 10193953 21-May-15 1:52am    
w = open("temp.txt", 'a') --> w = open("temp.txt", 'w')
Changes to the source , which was the test shown above .

5 attempted average value
Python 2.7: 4.0
Python 3.3: 7.2
Member 10193953 21-May-15 2:11am    
Test different time zones

5 attempted average value
Python 2.7: 4.6
Python 3.3: 8.4
Mohibur Rashid 21-May-15 3:40am    
I read in several forum supporting your claim that Python 2.7 is faster than 3+
you can search on google with the following term "python 2.7 vs 3.4 speed"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900