Python(2.5) reads an input file FASTER than pure C(Mingw)
n00m at narod.ru
Sat Apr 26 22:12:43 CEST 2008
>> char vs;
In the file 1001622(or so) records like phone number + f/l names.
So the reserving makes sense, i think. Populating of vector<string>
is by zillion times slower.
>> Is there an implementation of f.readlines on the internet somewhere?
I was greatly surprised how fast it is. As a matter of fact, it's the
of my message here.
>> BTW why are you declaring the array as 99 and pass 999 to fgets to read a
It doesn't matter. All the same, reading of a current line stopped at
Big number 999(9999,99999,...) just ensures that each line is read up
to its end.
>> fgets is part of the standard C++ library and it lives in the std
I thought it's from <stdio.h>. Anyway, it does not matter. PS Thanx
for the code.
Origin of my "discovery" is from http://www.spoj.pl/ranks/SBANK/start=400
I never thought it can be done in Python (there are a couple of Py
even faster than mine) and without stuff like radix sort etc.
More information about the Python-list