git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Makefile: conditionally include GIT-VERSION-FILE
@ 2020-12-07  0:39 Ramsay Jones
  2020-12-17 19:14 ` Pratyush Yadav
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2020-12-07  0:39 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: GIT Mailing-list


The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'
invocation of 'make clean'. For example, the second 'make clean' given
below:

  $ make clean >/dev/null 2>&1
  $ make clean
  GITGUI_VERSION = 0.21.0.85.g3e5c
  rm -rf git-gui lib/tclIndex po/*.msg
  rm -rf GIT-VERSION-FILE GIT-GUI-VARS
  $

has been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz,
8GB RAM, 1TB HDD).

Notice that the Makefile, as part of processing the 'clean' target, is
updating the 'GIT-VERSION-FILE' file.  This is to ensure that the
$(GITGUI_VERSION) make variable is set, once that file had been included.
However, the 'clean' target does not use the $(GITGUI_VERSION) variable,
so this is wasted effort.

In order to eliminate such wasted effort, use the value of the internal
$(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the
target is not 'clean'. (This drops the time down to 0.676s, on my laptop,
giving an improvement of 65.05%).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Pratyush,

This is the promised 'separated out' patch to git-gui from the "speed up
'make clean'" series. Note that the speed improvement doesn't appear to
be as good 'stand-alone'; it seems to be about 1.3s rather than 1.976s
when called as part of the git Makefile. (Also, on Linux, the numbers
are 0.091s ->  0.020s for an 78% improvement).

This patch was build on git-gui 'master' branch (@3e5c911) tonight.

Thanks!

ATB,
Ramsay Jones

 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index f10caed..56c85a8 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,9 @@ all::
 
 GIT-VERSION-FILE: FORCE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
+ifneq ($(MAKECMDGOALS),clean)
 -include GIT-VERSION-FILE
+endif
 
 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
 uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
-- 
2.29.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Makefile: conditionally include GIT-VERSION-FILE
  2020-12-07  0:39 [PATCH] Makefile: conditionally include GIT-VERSION-FILE Ramsay Jones
@ 2020-12-17 19:14 ` Pratyush Yadav
  0 siblings, 0 replies; 2+ messages in thread
From: Pratyush Yadav @ 2020-12-17 19:14 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list

On 07/12/20 12:39AM, Ramsay Jones wrote:
> 
> The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'
> invocation of 'make clean'. For example, the second 'make clean' given
> below:
> 
>   $ make clean >/dev/null 2>&1
>   $ make clean
>   GITGUI_VERSION = 0.21.0.85.g3e5c
>   rm -rf git-gui lib/tclIndex po/*.msg
>   rm -rf GIT-VERSION-FILE GIT-GUI-VARS
>   $
> 
> has been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz,
> 8GB RAM, 1TB HDD).
> 
> Notice that the Makefile, as part of processing the 'clean' target, is
> updating the 'GIT-VERSION-FILE' file.  This is to ensure that the
> $(GITGUI_VERSION) make variable is set, once that file had been included.
> However, the 'clean' target does not use the $(GITGUI_VERSION) variable,
> so this is wasted effort.
> 
> In order to eliminate such wasted effort, use the value of the internal
> $(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the
> target is not 'clean'. (This drops the time down to 0.676s, on my laptop,
> giving an improvement of 65.05%).
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---

Applied to git-gui/master. Thanks.

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-17 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07  0:39 [PATCH] Makefile: conditionally include GIT-VERSION-FILE Ramsay Jones
2020-12-17 19:14 ` Pratyush Yadav

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).