Message ID | patch-v5-3.8-9f42f40b518-20220303T160155Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | dafc2deade1a43100e6129755787a91569b82903 |
Headers | show |
Series | Makefile: optimize noop runs, add shared.mak | expand |
On Thu, Mar 03, 2022 at 05:04:14PM +0100, Ævar Arnfjörð Bjarmason wrote: [...] > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > --- > shared.mak | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/shared.mak b/shared.mak > index 0170bb397ae..29f0e69ecb9 100644 > --- a/shared.mak > +++ b/shared.mak > @@ -1,3 +1,14 @@ > +### Remove GNU make implicit rules > + > +## This speeds things up since we don't need to look for and stat() a > +## "foo.c,v" every time a rule referring to "foo.c" is in play. See > +## "make -p -f/dev/null | grep ^%::'". ^ A bit late to the party, but are you missing an opening single quote there? > +%:: %,v > +%:: RCS/%,v > +%:: RCS/% > +%:: s.% > +%:: SCCS/s.% > + > ### Flags affecting all rules > > # A GNU make extension since gmake 3.72 (released in late 1994) to > -- > 2.35.1.1230.ga6e6579e98c >
On Mon, Apr 11 2022, Rene Kita wrote: > On Thu, Mar 03, 2022 at 05:04:14PM +0100, Ævar Arnfjörð Bjarmason wrote: > > [...] > >> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> >> --- >> shared.mak | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/shared.mak b/shared.mak >> index 0170bb397ae..29f0e69ecb9 100644 >> --- a/shared.mak >> +++ b/shared.mak >> @@ -1,3 +1,14 @@ >> +### Remove GNU make implicit rules >> + >> +## This speeds things up since we don't need to look for and stat() a >> +## "foo.c,v" every time a rule referring to "foo.c" is in play. See >> +## "make -p -f/dev/null | grep ^%::'". > ^ > A bit late to the party, but are you missing an opening single quote > there? Yes, that's a typo. Oops!
diff --git a/shared.mak b/shared.mak index 0170bb397ae..29f0e69ecb9 100644 --- a/shared.mak +++ b/shared.mak @@ -1,3 +1,14 @@ +### Remove GNU make implicit rules + +## This speeds things up since we don't need to look for and stat() a +## "foo.c,v" every time a rule referring to "foo.c" is in play. See +## "make -p -f/dev/null | grep ^%::'". +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% + ### Flags affecting all rules # A GNU make extension since gmake 3.72 (released in late 1994) to
Override built-in rules of GNU make that use a wildcard target. This can speeds things up significantly as we don't need to stat() so many files. GNU make does that by default to see if it can retrieve their contents from RCS or SCCS. See [1] for an old mailing list discussion about how to disable these. The speed-up may vary. I've seen 1-10% depending on the speed of the local disk, caches, -jN etc. Running: strace -f -c -S calls make -j1 NO_TCLTK=Y Shows that we reduce the number of syscalls we make, mostly in "stat" calls. We could also invoke make with "-r" by setting "MAKEFLAGS = -r" early. Doing so might make us a bit faster still. But doing so is a much bigger hammer, since it will disable all built-in rules, some (all?) of which can be seen with: make -f/dev/null -p | grep -v -e ^# -e ^$ We may have something that relies on them, so let's go for the more isolated optimization here that gives us most or all of the wins. 1. https://lists.gnu.org/archive/html/help-make/2002-11/msg00063.html Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- shared.mak | 11 +++++++++++ 1 file changed, 11 insertions(+)