{"thread":{"id":"54784","subject":"[PATCH] Makefile: conditionally include GIT-VERSION-FILE","startedAt":"2020-12-07T00:40:21Z","lastAt":"2020-12-17T19:15:48Z","messageCount":2,"participants":["Ramsay Jones","Pratyush Yadav"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"411578","messageId":"ceacd2f6-c9c7-ef93-8bc2-0749770a260f@ramsayjones.plus.com","threadId":"54784","inReplyTo":null,"subject":"[PATCH] Makefile: conditionally include GIT-VERSION-FILE","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-12-07T00:39:30Z","receivedAt":"2020-12-07T00:40:21Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'\ninvocation of 'make clean'. For example, the second 'make clean' given\nbelow:\n\n  $ make clean >/dev/null 2>&1\n  $ make clean\n  GITGUI_VERSION = 0.21.0.85.g3e5c\n  rm -rf git-gui lib/tclIndex po/*.msg\n  rm -rf GIT-VERSION-FILE GIT-GUI-VARS\n  $\n\nhas been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz,\n8GB RAM, 1TB HDD).\n\nNotice that the Makefile, as part of processing the 'clean' target, is\nupdating the 'GIT-VERSION-FILE' file.  This is to ensure that the\n$(GITGUI_VERSION) make variable is set, once that file had been included.\nHowever, the 'clean' target does not use the $(GITGUI_VERSION) variable,\nso this is wasted effort.\n\nIn order to eliminate such wasted effort, use the value of the internal\n$(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the\ntarget is not 'clean'. (This drops the time down to 0.676s, on my laptop,\ngiving an improvement of 65.05%).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n\nHi Pratyush,\n\nThis is the promised 'separated out' patch to git-gui from the \"speed up\n'make clean'\" series. Note that the speed improvement doesn't appear to\nbe as good 'stand-alone'; it seems to be about 1.3s rather than 1.976s\nwhen called as part of the git Makefile. (Also, on Linux, the numbers\nare 0.091s ->  0.020s for an 78% improvement).\n\nThis patch was build on git-gui 'master' branch (@3e5c911) tonight.\n\nThanks!\n\nATB,\nRamsay Jones\n\n Makefile | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex f10caed..56c85a8 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -9,7 +9,9 @@ all::\n \n GIT-VERSION-FILE: FORCE\n \t@$(SHELL_PATH) ./GIT-VERSION-GEN\n+ifneq ($(MAKECMDGOALS),clean)\n -include GIT-VERSION-FILE\n+endif\n \n uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')\n-- \n2.29.0\n"},{"id":"412496","messageId":"20201217191447.xrijupbmqulnp3ym@yadavpratyush.com","threadId":"54784","inReplyTo":"ceacd2f6-c9c7-ef93-8bc2-0749770a260f@ramsayjones.plus.com","subject":"Re: [PATCH] Makefile: conditionally include GIT-VERSION-FILE","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2020-12-17T19:14:47Z","receivedAt":"2020-12-17T19:15:48Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"On 07/12/20 12:39AM, Ramsay Jones wrote:\n> \n> The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'\n> invocation of 'make clean'. For example, the second 'make clean' given\n> below:\n> \n>   $ make clean >/dev/null 2>&1\n>   $ make clean\n>   GITGUI_VERSION = 0.21.0.85.g3e5c\n>   rm -rf git-gui lib/tclIndex po/*.msg\n>   rm -rf GIT-VERSION-FILE GIT-GUI-VARS\n>   $\n> \n> has been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz,\n> 8GB RAM, 1TB HDD).\n> \n> Notice that the Makefile, as part of processing the 'clean' target, is\n> updating the 'GIT-VERSION-FILE' file.  This is to ensure that the\n> $(GITGUI_VERSION) make variable is set, once that file had been included.\n> However, the 'clean' target does not use the $(GITGUI_VERSION) variable,\n> so this is wasted effort.\n> \n> In order to eliminate such wasted effort, use the value of the internal\n> $(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the\n> target is not 'clean'. (This drops the time down to 0.676s, on my laptop,\n> giving an improvement of 65.05%).\n> \n> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> ---\n\nApplied to git-gui/master. Thanks.\n\n-- \nRegards,\nPratyush Yadav\n"}]}