Surprising (for me) benchmark results...
Michael Hudson
mwh21 at cam.ac.uk
Tue May 1 18:22:58 EDT 2001
emarkp at CSUA.Berkeley.EDU (E. Mark Ping) writes:
[python beats c++, java, perl in micro-benchmark]
> import time
>
> start = time.time()
> f = open("infile.txt", 'r')
> out = open("outfile.txt", 'w')
> l = f.readlines()
> l.sort()
^ this line would be my bet for why Python wins. What sort did you
use in the other languages?
> out.writelines(l)
> f.close()
> out.close()
> end = time.time()
>
> print (end-start), " seconds"
Still, a nice result.
Cheers,
M.
--
I don't have any special knowledge of all this. In fact, I made all
the above up, in the hope that it corresponds to reality.
-- Mark Carroll, ucam.chat
More information about the Python-list
mailing list