Bug 70511

Summary: [libc] When fread(3)ing with buffering turned off, many syscalls invoked.
Product: Base System Reporter: Dan Ponte <dcp1990>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: bdrewery, uau
Priority: Normal    
Version: 5.2.1-RELEASE   
Hardware: Any   
OS: Any   

Description Dan Ponte 2004-08-16 03:30:21 UTC
	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.

Fix: 

Change __srefill() in stdio to read blocks at a time, instead of one byte.
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.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:42 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Bryan Drewery freebsd_committer freebsd_triage 2021-08-24 23:31:05 UTC
https://reviews.freebsd.org/D30548