Hi!

On Tue, 2020-08-25 at 09:53:32 +0200, Jakub Wilk wrote:
> * Jakub Wilk <jw...@jwilk.net>, 2020-08-24, 18:41:
> > /usr/share/dpkg/architecture.mk is very slow:
> > 
> >  $ time printf 'include /usr/share/dpkg/architecture.mk\nall:\n\ttrue\n' | 
> > make -f - > /dev/null
> > 
> >  real    0m1.161s
> >  user    0m1.009s
> >  sys     0m0.127s
> > 
> > strace tells me this is because it spawns dpkg-architecture 33(!) times.
> 
> This is probably fallout after fixing #888964: lazy evaluation of the
> variables doesn't quite work when they are exported.

This seems to be an increasing regression in make:

  $ cat a.mk
  include /usr/share/dpkg/architecture.mk
  all:
        true
  (sid)$ time make -f a.mk
  real    0m0.824s
  user    0m0.702s
  sys     0m0.131s
  (buster)$ time make -f a.mk
  real    0m0.396s
  user    0m0.351s
  sys     0m0.054s
  (stretch)$ time make -f a.mk
  real    0m0.007s
  user    0m0.008s
  sys     0m0.000s

> You could use something like this to set all variables with only single
> dpkg-architecture call:
> 
>   $(foreach var,$(shell dpkg-architecture),$(eval export $(var)))
> 
> But it would need a guard to skip the call if all the variables were already
> set in environment.

Yes or add a new --print-make command or similar, but meh. I think
this might ideally need fixing in make?

Thanks,
Guillem

Reply via email to