Re: mmap in php_passthru_fd in file.c ?

From: Date: Fri, 18 May 2001 07:03:58 +0000
Subject: Re: mmap in php_passthru_fd in file.c ?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-55715@lists.php.net to get a copy of this message
At 10:40 PM 5/17/2001 -0700, Rasmus Lerdorf wrote:
True. But I guess my main issue is still that the behaviour changes radically based on a hidden configure check (ie. whether mmap is there or not) and that ensuring a block-by-block read in user space is inefficient for huge files.
good point... hrrmmm.... it seems like this is an option that should be available (somehow), yet I don't really like adding another option to the function, as it requires too much "smarts" on the behalf of the user (at what point does mmap() slow things down instead of speed them up, what is mmap(), etc.) Well, we do check and only do the mmap() for files larger than the block size. Perhaps automatic detection could be option? if (filesize > X) blockread else mmap? It seems like the most intuitive way to implement it... Sounds a bit magical. Why not just a block_readfile() function?
Why is it magical? It's an internal optimization and the developer will never know. I wouldn't add another file but make it a bit smarted only to mmap() small files and use fread() (the C version) for the rest). Andi

« previous php.dev (#55715) next »