Subject: mmap vs copying (was Re: a mmap'able audio device?? )
To: Brett Lymn <firstname.lastname@example.org.AU>
From: Travis Hassloch x231 <travis@EvTech.com>
Date: 03/04/1996 15:27:05
In message <199603040829.SAA29975@mallee.awadi> you write:
> The scheme does have the advantage of not requiring large amounts of
> data to cross the kernel/user boundary.
> I think mmap'ing the dma buffer would result in a performance gain.
This reminds me of a paper I have sitting on my desk where a group
replaced the stdio/unixio/et.al. with some "personalities" that rode
over what was essentially a mmap/shmget lower layer.
Their argument is that a typical stdio filter-type program may copy data
four times in core; buf->library->modify_in_app_buffer->library->driver
Where library is the stdio buffer area (so you can ungetc, etc).
By using a plug-in-replacement for stdio, they transparently used mmap
to eliminate two copies (the lib buffer). By modifying the source, you
could do away with any copies (except the application-specific
transformations of course).
They simply relinked diff and achieved a 2.12 speedup factor under AIX.
SunOS and AIX had more modest gains (1.27, 1.44). Upon modification
to use their new interface, the gains were 3.67, 1.38, 2.12 respectively.
Unix I/O applications were, on average, degraded a little (2%) without
modification to use their special interface, but reclaimed it upon
modification. It was also a concurrent interface.