bin/70511: When fread()ing with buffering turned off, many syscalls invoked.

Dan Ponte dcp1990 at cox.net
Sun Aug 15 19:30:22 PDT 2004


>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 at 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:


More information about the freebsd-bugs mailing list