Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] xreadlines : readlines :: xrange : range

Guido van Rossumguido@python.org
Thu, 04 Jan 2001 10:27:28 -0500


[Me & Thomas in violent agreement that there's something weird aboutthe speed of getc_unlocked() vs. getc() on FreeBSD.]I just realized what's the probable cause.  Read your timing postagain:# BSDI:# # (Python 2.0)# while_readline        1.006  1.000# # (CVS Python + getc_unlocked)# while_readline        0.363  0.367# FreeBSD:# # (Standard CVS Python)# while_readline        0.214  0.219# # (CVS+getc_unlocked)# while_readline        0.283  0.281Standard CVS Python, as opposed to Python 2.0 as released, uses GNUgetline()!  So on FreeBSD, for this test case, GNU getline() is fasterthan getc_unlocked().So the question is, should I leave the GNU getline() code in?  I'minclined against it -- it's not that much faster, and on otherplatform getc_unlocked() is faster.  Given that getc_unlocked() is astandard (of some sort) and GNU getline() is, well, just that, I'd saylet's stick with getc_unlocked().(Unfortunately, from a phone conversation I had last night with Tim,there's not much hope of doing something there -- and that platformsorely needs it!  The hacks that Tim reported earlier are definitelynot thread-safe.  While it's easy to come up with getc_unlocked() forWindows, the locking operations used internally there by the /MT codeare not exported from MSVCRT.DLL, and that's crucial.)--Guido van Rossum (home page:http://www.python.org/~guido/)


[8]ページ先頭

©2009-2025 Movatter.jp