Bug 70511 - [libc] When fread(3)ing with buffering turned off, many syscalls invoked.
Summary: [libc] When fread(3)ing with buffering turned off, many syscalls invoked.
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 5.2.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-16 03:30 UTC by Dan Ponte
Modified: 2021-08-24 23:31 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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