Re: Faster install-sh in C - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Faster install-sh in C
Date
Msg-id 200503252305.j2PN52m23610@candle.pha.pa.us
Whole thread Raw
In response to Re: Faster install-sh in C  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Faster install-sh in C
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > OK, what is 'install' doing for us that 'cp' and 'chmod' would not
> > already do?
>
> Quite a lot of things, such as coping with busy target files --- not too
> important for headers, but very important for executables and shlibs.
>
> We might be able to get away with this for just the headers, though,
> and that's certainly the bulk of the install work now.

Here is my next version of the patch that uses 'cp' and 'chmod' to
install multiple header files rather than 'install'.

I moved the file modes into variables so any changes are propogated to
src/include/Makefile.

This is 20 times faster than what we have now, 8 seconds vs 0.40 seconds.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.212
diff -c -c -r1.212 Makefile.global.in
*** src/Makefile.global.in    25 Mar 2005 18:17:12 -0000    1.212
--- src/Makefile.global.in    25 Mar 2005 22:58:33 -0000
***************
*** 232,240 ****

  INSTALL    = $(SHELL) $(top_srcdir)/config/install-sh -c

  INSTALL_PROGRAM    = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
! INSTALL_SCRIPT    = $(INSTALL) -m 755
! INSTALL_DATA    = $(INSTALL) -m 644
  INSTALL_STLIB    = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
  INSTALL_SHLIB    = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
  # Override in Makefile.port if necessary
--- 232,242 ----

  INSTALL    = $(SHELL) $(top_srcdir)/config/install-sh -c

+ INSTALL_SCRIPT_MODE    = 755
+ INSTALL_DATA_MODE    = 644
  INSTALL_PROGRAM    = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
! INSTALL_SCRIPT    = $(INSTALL) -m $(INSTALL_SCRIPT_MODE)
! INSTALL_DATA    = $(INSTALL) -m $(INSTALL_DATA_MODE)
  INSTALL_STLIB    = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
  INSTALL_SHLIB    = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
  # Override in Makefile.port if necessary
Index: src/include/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/include/Makefile,v
retrieving revision 1.19
diff -c -c -r1.19 Makefile
*** src/include/Makefile    6 Jan 2005 21:00:24 -0000    1.19
--- src/include/Makefile    25 Mar 2005 22:58:37 -0000
***************
*** 37,49 ****
  # These headers are needed for server-side development
      $(INSTALL_DATA) pg_config.h    $(DESTDIR)$(includedir_server)
      $(INSTALL_DATA) pg_config_os.h $(DESTDIR)$(includedir_server)
!     for file in $(srcdir)/*.h; do \
!       $(INSTALL_DATA) $$file $(DESTDIR)$(includedir_server)/`basename $$file` || exit; \
!     done
      for dir in $(SUBDIRS); do \
!       for file in $(srcdir)/$$dir/*.h; do \
!         $(INSTALL_DATA) $$file $(DESTDIR)$(includedir_server)/$$dir/`basename $$file` || exit; \
!       done \
      done

  installdirs:
--- 37,48 ----
  # These headers are needed for server-side development
      $(INSTALL_DATA) pg_config.h    $(DESTDIR)$(includedir_server)
      $(INSTALL_DATA) pg_config_os.h $(DESTDIR)$(includedir_server)
! # We don't use INSTALL_DATA for performance reasons --- there are a lot of files
!     cp $(srcdir)/*.h $(DESTDIR)$(includedir_server)/ || exit; \
!     chmod $(INSTALL_DATA_MODE) $(DESTDIR)$(includedir_server)/*.h  || exit; \
      for dir in $(SUBDIRS); do \
!       cp $(srcdir)/$$dir/*.h $(DESTDIR)$(includedir_server)/$$dir/ || exit; \
!       chmod $(INSTALL_DATA_MODE) $(DESTDIR)$(includedir_server)/$$dir/*.h  || exit; \
      done

  installdirs:

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Makefile breakage
Next
From: Tom Lane
Date:
Subject: Re: Faster install-sh in C