Date: Sun, 15 Aug 2004 22:21:46 -0400 (EDT) From: Dan Ponte <dcp1990@cox.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: uau@users.sourceforge.net Subject: bin/70511: When fread()ing with buffering turned off, many syscalls invoked. Message-ID: <20040816022146.797EE409E@styx.flinkpoyd.homeunix.com> Resent-Message-ID: <200408160230.i7G2UM3h086705@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 70511
>Category: bin
>Synopsis: When fread()ing with buffering turned off, many syscalls invoked.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Aug 16 02:30:21 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Dan Ponte
>Release: FreeBSD 5.2.1-RELEASE-p9 i386
>Organization:
Unix Users Anonymous
>Environment:
System: FreeBSD styx.cox.net 5.2.1-RELEASE-p9 FreeBSD 5.2.1-RELEASE-p9 #7: Thu Jul 1 13:17:08 EDT 2004 dcp1990@styx.cox.net:/usr/obj/usr/src/sys/STYX i386
Python 2.2.2
>Description:
When calling fread and buffering turned off, a read() syscall is made for each byte. With large limits, this may take a while and is very inefficient.
>How-To-Repeat:
In python, enter the following command:
t=file('bigfile', 'r', 0).read(10000000)
, replacing 'bigfile' with a large file. Notice how it takes a while to run. Now, start Python with truss and enter the same, and notice the flood of read() syscalls.
>Fix:
Change __srefill() in stdio to read blocks at a time, instead of one byte.
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040816022146.797EE409E>
