Bug#968963: dpkg-dev: architecture.mk is slow

2021-06-20 Thread Nicolas Boulenguez
Package: dpkg-dev
Version: 1.20.9
Followup-For: Bug #968963
Control: severity 872381 normal
Control: tags -1 patch
Control: merge -1 872381

This bug duplicates 872381, which carries a patch.



Bug#968963: dpkg-dev: architecture.mk is slow

2020-09-03 Thread Guillem Jover
On Tue, 2020-08-25 at 14:58:15 +0200, Jakub Wilk wrote:
> * Guillem Jover , 2020-08-25, 11:26:
> > This seems to be an increasing regression in make:
> 
> I don't belive it is.

Indeed! Sorry bad testing procedure from my side.

> >  $ cat a.mk
> >  include /usr/share/dpkg/architecture.mk

This should have been instead something like:

  include scripts/mk/architecture.mk

> >  all:
> > true
> >  (sid)$ time make -f a.mk
> >  real0m0.824s
> >  user0m0.702s
> >  sys 0m0.131s
> >  (buster)$ time make -f a.mk
> >  real0m0.396s
> >  user0m0.351s
> >  sys 0m0.054s
> 
> Hmm, I don't see any significant difference in speed between buster and sid
> chroots here. (Though curiously they are about twice as fast as my normal
> sid system.)

This seems to have been caused by commit
f6e152b63f9eb183313807898be0569f5321bdf6. So now I'm a bit conflicted,
because that change still make sense. And while the slow down should
not really be visible when building with dpkg-buildpackage as the vars
would then be pre-set, it defeats the point of the lazy logic there.

So I guess I'll move to adding a new --export-make or similar.

Thanks,
Guillem



Bug#968963: dpkg-dev: architecture.mk is slow

2020-08-25 Thread Jakub Wilk

* Guillem Jover , 2020-08-25, 11:26:

This seems to be an increasing regression in make:


I don't belive it is.


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


Hmm, I don't see any significant difference in speed between buster and 
sid chroots here. (Though curiously they are about twice as fast as my 
normal sid system.)



 (stretch)$ time make -f a.mk
 real0m0.007s
 user0m0.008s
 sys 0m0.000s


Yes, stretch is fast. But if I upgrade dpkg-dev to the current version, 
it's as slow as buster or sid.


--
Jakub Wilk



Bug#968963: dpkg-dev: architecture.mk is slow

2020-08-25 Thread Guillem Jover
Hi!

On Tue, 2020-08-25 at 09:53:32 +0200, Jakub Wilk wrote:
> * Jakub Wilk , 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
> > 
> >  real0m1.161s
> >  user0m1.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
  real0m0.824s
  user0m0.702s
  sys 0m0.131s
  (buster)$ time make -f a.mk
  real0m0.396s
  user0m0.351s
  sys 0m0.054s
  (stretch)$ time make -f a.mk
  real0m0.007s
  user0m0.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



Bug#968963: dpkg-dev: architecture.mk is slow

2020-08-25 Thread Jakub Wilk

* Jakub Wilk , 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

 real0m1.161s
 user0m1.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.


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.


--
Jakub Wilk



Bug#968963: dpkg-dev: architecture.mk is slow

2020-08-24 Thread Jakub Wilk

Package: dpkg-dev
Version: 1.20.5

/usr/share/dpkg/architecture.mk is very slow:

  $ time printf 'include /usr/share/dpkg/architecture.mk\nall:\n\ttrue\n' | make 
-f - > /dev/null

  real0m1.161s
  user0m1.009s
  sys 0m0.127s

strace tells me this is because it spawns dpkg-architecture 33(!) times.

Please speed this up.


-- System Information:
Architecture: i386

Versions of packages dpkg-dev depends on:
ii  perl  5.30.3-4
ii  libdpkg-perl  1.20.5
ii  tar   1.30+dfsg-7
ii  bzip2 1.0.8-4
ii  xz-utils  5.2.4-1+b1
ii  patch 2.7.6-6
ii  make  4.3-4
ii  binutils  2.35-2

--
Jakub Wilk