Hi Paul, On 2023-09-03 04:09, Paul Smith wrote: > On Sun, 2023-09-03 at 01:03 +0200, Alejandro Colomar wrote: >> I was also wondering... is ONESHELL significant for performance? >> Does the reduction in number of shells speed up things? > > It might increase performance but that's not what it's for primarily,
For those wondering, here's an experiment with a rule that runs a few shells (given appropriate values for certain variables): $ time make -j install DESTDIR=/tmp/foo Z=.gz LINK_PAGES=symlink >/dev/null real 0m6.229s user 0m17.820s sys 0m5.269s $ sed -i '/ONESHELL/s/^/#/' GNUmakefile $ time make -j install DESTDIR=/tmp/bar Z=.gz LINK_PAGES=symlink >/dev/null real 0m8.511s user 0m23.823s sys 0m7.511s It's not orders of magnitude, but it might be interesting to cut a 25%, considering no obvious pitfalls (when you overcome the SHELL errors, that is :D). For rules with just 1 canned recipe, the times didn't change. Here's the rule I used (I chose it because it's the most complex rule in the Makefile, as it has 3 canned recipes): $(_manpages): $(info INSTALL $@) <$< \ $(SED) $(foreach s, $(MANSECTIONS), \ -e '/^\.so /s, man$(s)/\(.*\)\.$(s)$$, $(notdir $(man$(s)dir))/\1$(man$(s)ext)$(Z),') \ | $(INSTALL_DATA) -T /dev/stdin $@ ifeq ($(LINK_PAGES),symlink) if $(GREP) '^\.so ' <$@ >/dev/null; then \ $(GREP) '^\.so ' <$@ \ | $(SED) 's,^\.so \(.*\),../\1,' \ | $(XARGS) -I tgt $(LN) -fsT tgt $@; \ fi endif ifeq ($(Z),.bz2) if ! $(TEST) -L $@; then \ $(BZIP2) $(BZIP2FLAGS) <$@ \ | $(SPONGE) $@; \ fi else ifeq ($(Z),.gz) if ! $(TEST) -L $@; then \ $(GZIP) $(GZIPFLAGS) <$@ \ | $(SPONGE) $@; \ fi else ifeq ($(Z),.lz) if ! $(TEST) -L $@; then \ $(LZIP) $(LZIPFLAGS) <$@ \ | $(SPONGE) $@; \ fi else ifeq ($(Z),.xz) if ! $(TEST) -L $@; then \ $(XZ) $(XZFLAGS) <$@ \ | $(SPONGE) $@; \ fi endif > at least not in my opinion. It's there for people who want to use > shells other than POSIX sh as their SHELL value, Well, my SHELL is not the POSIX sh, as I'm using bash(1), but I get it's still POSIX-sh-like, not python. :) > where it's not so easy > to create an entire script on a single line and using backslashes. Can we really call it script if it's invoked via sh -c? It's more like a command line. :) Jokes apart, can you put an example of such a scenario? I'm not imagining it. BTW, apart from fixing the SHELL (which was a good thing, anyway), the only change I needed was to remove the '+' from a couple of recipes (and keep only the first one). Not a big deal. Most rules work without modification. Cheers, Alex -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
OpenPGP_signature
Description: OpenPGP digital signature