On Wed, Jul 23, 2003 at 08:31:42PM +0200, Juergen Boemmels wrote: > GetCount > Fill > What should these calls do?
These look like they are for buffering layers. For a long time the perl5 tried to "cheat" stdio by sneaking data directly out of the stdio buffers. To do this, it was trying to keep track of the count of how many bytes remained, and using getchar() or somesuch to get the buffer refilled. The PerlIO system implemented for 5.8 has a fill method to explictly refill the buffer of the layer you are reading from, and Get_ptr and Get_cnt to get the current pointer and remaining byte count of the buffer. If perl5 can't figure out stdio, it doesn't "cheat" on it. Curiously when I taught Configure how to figure out glibc stdio, the relevant perlbench test speeded up enormously. When I taught it to cheat on FreeBSD stdio, there was no difference. Maybe I'm jumping to conclusions based on insufficient data, but I'd hope that a well designed buffer read API would be fast enough to avoid need for these buffer snooping games. I'm hoping that we can use sufficiently "regular" buffers that we can copy on write all the way up the stack from the kernel read to the PMCs presenting data at language level, so that for read only grepping of files there is no data copying at all. (And hopefully the file at the bottom is memory mapped) Nicholas Clark