You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Hyde <bh...@gensym.com> on 1997/11/11 23:20:52 UTC

performance tweak.

In default_handler, avoid the mmap call, if
we don't need the file's content.

Index: src/main/http_core.c
===================================================================
RCS file: /cvs/apachen/src/main/http_core.c,v
retrieving revision 1.135
diff -c -r1.135 http_core.c
*** http_core.c	1997/11/08 21:42:36	1.135
--- http_core.c	1997/11/11 22:15:14
***************
*** 1744,1752 ****
  
  #ifdef USE_MMAP_FILES
      block_alarms();
!     if (r->finfo.st_size >= MMAP_THRESHOLD) {
! 	/* we need to protect ourselves in case we die while we've got the
! 	 * file mmapped */
  	mm = mmap (NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
  		    fileno(f), 0);
      } else {
--- 1744,1753 ----
  
  #ifdef USE_MMAP_FILES
      block_alarms();
!     if ((r->finfo.st_size >= MMAP_THRESHOLD)
! 	&& ( !r->header_only || (d->content_md5 & 1))) {
!       /* we need to protect ourselves in case we die while we've got the
!  	 * file mmapped */
  	mm = mmap (NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
  		    fileno(f), 0);
      } else {

Re: performance tweak.

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Tue, Nov 11, 1997 at 05:20:52PM -0500, Ben Hyde wrote:
> In default_handler, avoid the mmap call, if
> we don't need the file's content.

+1
    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: performance tweak.

Posted by Dean Gaudet <dg...@arctic.org>.
+1, thanks for spotting this. 

Dean

On Tue, 11 Nov 1997, Ben Hyde wrote:

> 
> In default_handler, avoid the mmap call, if
> we don't need the file's content.
> 
> Index: src/main/http_core.c
> ===================================================================
> RCS file: /cvs/apachen/src/main/http_core.c,v
> retrieving revision 1.135
> diff -c -r1.135 http_core.c
> *** http_core.c	1997/11/08 21:42:36	1.135
> --- http_core.c	1997/11/11 22:15:14
> ***************
> *** 1744,1752 ****
>   
>   #ifdef USE_MMAP_FILES
>       block_alarms();
> !     if (r->finfo.st_size >= MMAP_THRESHOLD) {
> ! 	/* we need to protect ourselves in case we die while we've got the
> ! 	 * file mmapped */
>   	mm = mmap (NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
>   		    fileno(f), 0);
>       } else {
> --- 1744,1753 ----
>   
>   #ifdef USE_MMAP_FILES
>       block_alarms();
> !     if ((r->finfo.st_size >= MMAP_THRESHOLD)
> ! 	&& ( !r->header_only || (d->content_md5 & 1))) {
> !       /* we need to protect ourselves in case we die while we've got the
> !  	 * file mmapped */
>   	mm = mmap (NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
>   		    fileno(f), 0);
>       } else {
>