Movatterモバイル変換
[0]ホーム
[Python-Dev] speed up readline() using getc_unlocked()
Guido van Rossumguido@python.org
Wed, 03 Jan 2001 16:36:07 -0500
> On Solaris 2.6, the configure script doesn't detect that> getc_unlocked() & friends are supported; details available from the> patch.(Fixed now, see the new patch.)> After editing config.h manually to enable them, the results are:>> Before getc_unlocked patch:> total 1559913 chars and 32513 lines> count_chars_lines 0.892 0.730> readlines_sizehint 0.329 0.300> using_fileinput 4.612 4.470> while_readline 2.739 2.670>> After patch:> total 1559913 chars and 32513 lines> count_chars_lines 0.698 0.680> readlines_sizehint 0.273 0.270> using_fileinput 2.707 2.700> while_readline 0.778 0.780> amarok src>>> With a patched version of fileinput.py:> using_fileinput 1.675 1.680Thanks! The bottom line seems to be that your basic readline loop isstill 3x as slow as the fastest way -- so there's still a lot to sayfor xreadlines...--Guido van Rossum (home page:http://www.python.org/~guido/)
[8]ページ先頭