diff mbox

[FFmpeg-devel,3/3] configure: speedup x2-x8

Message ID 989623233.2592064.1535220670315@mail.yahoo.com
State Superseded
Headers show

Commit Message

avih Aug. 25, 2018, 6:11 p.m. UTC
For overview see:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html

Attached is patch 3/3 which was at "main.patch" of that message.

After the previous speedups, configure spent 20-60% of its runtime
at check_deps(). It's particularly slow with bash. After some local
optimizations - mainly avoid pushvar/popvar and abort early in one
notable case (empty deps), it's now x4-x25 faster.

After this patch, pushvar() and popvar() are not used but
I was hesitant to remove them (nice to have). If you think it should
be removed, the patch "opt2-remove-pushvar.patch" removes them.
 

    On Saturday, August 25, 2018 7:55 PM, Timo Rothenpieler <timo@rothenpieler.org> wrote:
 

 Please use git send-email to send your patches, or at least send each 
patch, created by git format-patch, as individual attachment. Your files 
seem to contain multiple patches one after another, which makes them 
very hard to follow.

But nice work! Let's hope this does not cause any regressions.

Comments

Michael Niedermayer Aug. 25, 2018, 9:15 p.m. UTC | #1
On Sat, Aug 25, 2018 at 06:11:10PM +0000, avih wrote:
> For overview see:
> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html
> 
> Attached is patch 3/3 which was at "main.patch" of that message.
> 
> After the previous speedups, configure spent 20-60% of its runtime
> at check_deps(). It's particularly slow with bash. After some local
> optimizations - mainly avoid pushvar/popvar and abort early in one
> notable case (empty deps), it's now x4-x25 faster.
> 

patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64

[...]
Helmut K. C. Tessarek Aug. 26, 2018, 7:39 p.m. UTC | #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 2018-08-25 14:11, avih wrote:
> For overview see: 
> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html
> 
> Attached is patch 3/3 which was at "main.patch" of that message.
> 
> After the previous speedups, configure spent 20-60% of its runtime 
> at check_deps(). It's particularly slow with bash. After some
> local optimizations - mainly avoid pushvar/popvar and abort early
> in one notable case (empty deps), it's now x4-x25 faster.

Patch 1-3 work fine on macOS. The configure time decreased by 75% on
my machine.

Awesome patch.

Cheers,
  K. C.

- -- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE191csiqpm8f5Ln9WvgmFNJ1E3QAFAluDAdwACgkQvgmFNJ1E
3QAYLg//T1ftuIcO9t5jLRKYYSi9mHQau0y0LlsNqvPyGk0ht+Wu04WumtsS/K0z
aLAWTSX+vWShkwn/ncGCxZlrgUdXDfmc/y8jIGKXuHV/39ZhN5Y7CO11vNn/efdE
XjWlXsdpadtyqnwtWdrmOmvufiVNhVxXbLAHETnT6afFNRDVxKWl4JboiU3kNVUX
K7WTqvBBMqeSRIHhgRX/n40mNItp4vxk9WQGz8E+rcoipR5DIpokYb987aLzl0Y2
6gTFXY7HqCtY3oWJe70XuHY+/a/6z3Y6YD6i5o7QpYfyXJcbBz3PvzKJxdg/5W8S
Q92780We9H61wXxf5cpoobJJcEIZ3/HTXE7O5zEWKrLrmNbGwV4wecBoWWaoHa9V
5lMkmC5yrx2b2WKoLG6sYTgq9h1UYSi3bNHTvuGKZ36mmgGz2Tx89ctr5hteakEB
dreAmeLZGgI4g+PFjastnWGl9C+JmgUQwe0sTHNsKNqOyio0zQXgk+cpjuRNOx+X
USD6hYp9sn6A0d8vh1Pgw3FnbWp2yc5NDmkwRIl/39icH19WJUtgHZKd1x40SHyV
fPhLJKPaNmbdR4kSM/AMUUlVmthAD3nZyvPOdR/b94i/SsivRhWiiuk0L2lODOx0
mtNU8vJG1rcqLbNTQo0tkorH31CalzXnekInUrX5soeDZg8ywe8=
=6p2H
-----END PGP SIGNATURE-----
Helmut K. C. Tessarek Aug. 26, 2018, 10:35 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 2018-08-25 17:15, Michael Niedermayer wrote:
> patches 1-3 work here fine on linux x86-64 / 32, arm, mips,
> wine+mingw32/64

Any chance you (or anyone who's commit access to the repo) could
commit these 3 patches asap?

Cheers,
  K. C.

- -- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE191csiqpm8f5Ln9WvgmFNJ1E3QAFAluDKzIACgkQvgmFNJ1E
3QDy3w//Xy2DQFyT5aQvFhadc+bmnuxMqYMIQy625rPbttPIid1q+oxUGTJPmtTu
tNA8vP+mf11wUMbY4RFH94Te1ClRtYTiCoZgWSGm3gcHemiM2VfCE2SYuj1pAW/M
BxJPmVK7pIy58dvX5DsyiRqLNA89OeV1eHsGfdJ+hpZ90OgvQtsatfj91SJO/Yfe
DoStKl6LrvfcgAR2Y3mSCbWfBpnU8SwmMGra4YuN0OZH9TZDX1vtI1Ok+D1JgtHC
H/64ha08C+56dwil55Zawugii8sAX24cwtxCLQ0CLgIdSFxHbIOiGZCBZFS0gIBL
8zV5GOONZEt0wXzFH1BWZvRra/mr828TEs3I/IbmFuXkAVpLLZpGcB9TTU6noScu
ZKtn005CM2CynjZvm+4cQrLxzzex9XhL5miD8pY9EigKnMixeGP7PftmoCFV8maq
uVlLfF1YEGAXLxW/br4PF6lA/QsSOkosqI8SxSBt/KzE12sgcE5cIWlqxUEBDsBd
P57XAM6qCWFQec2lzcczS6BWL9qtrgQsT4A0Rs+FTGRppnjY3MKFRDKF/5d8ml3W
R7jPfWlmPfR3XKPldivo3GTfNfny3u1HPidrDFjA5QW+0gheuVgyoSrVGjouj1H2
v0JKbDLp95Gg+GmolAyeXfHAqG2vK51/KwVwzUKEauDnxcPuDvE=
=5wNw
-----END PGP SIGNATURE-----
James Almer Aug. 27, 2018, 2:41 p.m. UTC | #4
On 8/25/2018 6:15 PM, Michael Niedermayer wrote:
> On Sat, Aug 25, 2018 at 06:11:10PM +0000, avih wrote:
>> For overview see:
>> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html
>>
>> Attached is patch 3/3 which was at "main.patch" of that message.
>>
>> After the previous speedups, configure spent 20-60% of its runtime
>> at check_deps(). It's particularly slow with bash. After some local
>> optimizations - mainly avoid pushvar/popvar and abort early in one
>> notable case (empty deps), it's now x4-x25 faster.
>>
> 
> patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64

Just pushed them.

Thanks a lot Avi for this! Configure slowness has been pretty
discouraging for devs for some time now.
avih Aug. 27, 2018, 4:09 p.m. UTC | #5
Thanks.
I was similarly frustrated with the long runtime of configure, hence I decided to try and do something about it.
Luckily, it it was only about 50 LOC which were responsible for it. It could have been much more daunting if the slowness was all over the place.
Finding those 50 lines was another matter though. I had to build a nice magnet (time.sh) to find the needles in this haystack ;)

Glad others like it too.
Avi
 

    On Monday, August 27, 2018 5:49 PM, James Almer <jamrial@gmail.com> wrote:
 

 On 8/25/2018 6:15 PM, Michael Niedermayer wrote:
> On Sat, Aug 25, 2018 at 06:11:10PM +0000, avih wrote:
>> For overview see:
>> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html
>>
>> Attached is patch 3/3 which was at "main.patch" of that message.
>>
>> After the previous speedups, configure spent 20-60% of its runtime
>> at check_deps(). It's particularly slow with bash. After some local
>> optimizations - mainly avoid pushvar/popvar and abort early in one
>> notable case (empty deps), it's now x4-x25 faster.
>>
> 
> patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64

Just pushed them.

Thanks a lot Avi for this! Configure slowness has been pretty
discouraging for devs for some time now.
Michael Niedermayer Aug. 27, 2018, 7:56 p.m. UTC | #6
On Mon, Aug 27, 2018 at 11:41:26AM -0300, James Almer wrote:
> On 8/25/2018 6:15 PM, Michael Niedermayer wrote:
> > On Sat, Aug 25, 2018 at 06:11:10PM +0000, avih wrote:
> >> For overview see:
> >> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html
> >>
> >> Attached is patch 3/3 which was at "main.patch" of that message.
> >>
> >> After the previous speedups, configure spent 20-60% of its runtime
> >> at check_deps(). It's particularly slow with bash. After some local
> >> optimizations - mainly avoid pushvar/popvar and abort early in one
> >> notable case (empty deps), it's now x4-x25 faster.
> >>
> > 
> > patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64
> 

> Just pushed them.

thanks!

[...]
diff mbox

Patch

From 77f897c8ed4eec9119d758037b0311629f549a5b Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" <avihpit@yahoo.com>
Date: Wed, 1 Aug 2018 09:10:12 +0300
Subject: [PATCH] configure: remove unused pushvar()/popvar()

---
 configure | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/configure b/configure
index e9cb7703..d6c1d032 100755
--- a/configure
+++ b/configure
@@ -619,25 +619,6 @@  get_sanitized(){
     eval echo \$$(sanitize_var_name "$1")
 }
 
-pushvar(){
-    for pvar in $*; do
-        eval level=\${${pvar}_level:=0}
-        eval ${pvar}_${level}="\$$pvar"
-        eval ${pvar}_level=$(($level+1))
-    done
-}
-
-popvar(){
-    for pvar in $*; do
-        eval level=\${${pvar}_level:-0}
-        test $level = 0 && continue
-        eval level=$(($level-1))
-        eval $pvar="\${${pvar}_${level}}"
-        eval ${pvar}_level=$level
-        eval unset ${pvar}_${level}
-    done
-}
-
 request(){
     for var in $*; do
         eval ${var}_requested=yes
-- 
2.17.1