All of lore.kernel.org
 help / color / mirror / Atom feed
* [mlmmj] read(2) syscall bloat
@ 2011-09-05 11:56 Moritz Wilhelmy
  2011-09-05 12:30 ` Lukas Fleischer
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Moritz Wilhelmy @ 2011-09-05 11:56 UTC (permalink / raw)
  To: mlmmj

Hello,

mlmmj currently does a read(2) system call for every single byte it
reads from a file descriptor. This is unnecessarily inefficient and
slow. 

Strace output is similar to the following:
open("/var/spool/mlmmj/foo/control/listaddress", O_RDONLY) = 4
read(4, "f", 1)                         = 1
read(4, "o", 1)                         = 1
read(4, "o", 1)                         = 1
read(4, "@", 1)                         = 1
read(4, "l", 1)                         = 1
read(4, "i", 1)                         = 1
read(4, "s", 1)                         = 1
read(4, "t", 1)                         = 1
read(4, "s", 1)                         = 1
read(4, ".", 1)                         = 1
read(4, "e", 1)                         = 1
read(4, "x", 1)                         = 1
read(4, "a", 1)                         = 1
read(4, "m", 1)                         = 1
read(4, "p", 1)                         = 1
read(4, "l", 1)                         = 1
read(4, "e", 1)                         = 1
read(4, ".", 1)                         = 1
read(4, "c", 1)                         = 1
read(4, "o", 1)                         = 1
read(4, "m", 1)                         = 1
read(4, "\n", 1)                        = 1
close(4)                                = 0

Given that there is a getline(3) function in POSIX.1-2008, shouldn't it
be possible to retire mygetline?

I've previously posted this issue to the musl mailing list [1], which
has an "anti-bloat side project", but I've been putting the mail to this
list off.

I don't see where any of Rich's arguments from [2] apply. Can anyone
please explain why it was done this way in the first place?

[1] http://www.openwall.com/lists/musl/2011/08/16/8
[2] http://www.openwall.com/lists/musl/2011/08/16/11

	Moritz


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-09  8:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-05 11:56 [mlmmj] read(2) syscall bloat Moritz Wilhelmy
2011-09-05 12:30 ` Lukas Fleischer
2011-09-05 12:34 ` Ben Schmidt
2011-09-05 12:46 ` Lukas Fleischer
2011-09-05 12:57 ` Moritz Wilhelmy
2011-09-09  8:24 ` Thomas Goirand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.