Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Nevo Hed <nhed+buildroot@starry.com>
Cc: thomas.petazzoni@bootlin.com, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] core: Use of percent_defconfig seems to impact performance
Date: Sat, 7 Jan 2023 21:15:26 +0100	[thread overview]
Message-ID: <20230107201526.GA151997@scaer> (raw)
In-Reply-To: <20230105015759.63582-2-nhed+buildroot@starry.com>

Nevo, All,

On 2023-01-04 20:57 -0500, Nevo Hed via buildroot spake thusly:
> Noticed a significant slowdown with rise of number of external trees
> in our env.  This slowdown seemed to be related to invocations if the
> percent_defconfig function (GNU Make 4.3).
> 
> While I have not do a deep dive in analyzing the performance issue, it
> felt like redefining the %_defconfig rule N times impact performance.
> 
> This patch makes %_defconfig a single rule which combines uses the
> first return of a wildcard expression.
> 
> Timing (seconds) of `make pc_x86_64_bios_defconfig` with 1-8 external
> trees:
> 
>     #Trees    Before    After
>          1      0.38     0.37
>          2      0.32     0.31
>          3      0.31     0.33
>          4      0.36     0.32
>          5      0.45     0.35
>          6      1.26     0.36
>          7      9.10     0.36
>          8     85.93     0.42
> 
> Signed-off-by: Nevo Hed <nhed+buildroot@starry.com>

Thanks for the respin, I like it better than your first iteration, and
most importantly, better than my own implementation!

I however used most of my commit log, a=exteneded it even further,
provided my reproducibility script in the commit log and redid the
timings up to 1000 trees (heck, it's manageable now, so why not!).

I also slightly reformatted the code, to split the long lines.

Finally, I also added David as the reporter, and that his bug #14996
is now fixed.

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  Makefile | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 88f90cd2fa..ad866f1f24 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1013,13 +1013,14 @@ oldconfig syncconfig olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmake
>  defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
>  	@$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
>  
> -define percent_defconfig
> -# Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
> -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig outputmakefile
> -	@$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \
> -		$$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN)
> -endef
> -$(eval $(foreach d,$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)),$(call percent_defconfig,$(d))$(sep)))
> +%_defconfig: $(BUILD_DIR)/buildroot-config/conf  outputmakefile
> +	@defconfig=$(or \
> +		$(firstword $(foreach d, \
> +			$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)),$(wildcard $(d)/configs/$@))), \
> +		$(error "Can't find $@") \
> +	); \
> +	$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$${defconfig} \
> +		$< --defconfig=$${defconfig} $(CONFIG_CONFIG_IN)
>  
>  update-defconfig: savedefconfig
>  
> -- 
> 2.38.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-01-07 20:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05  1:57 [Buildroot] [PATCH v2 0/1] core: Use of percent_defconfig seems to impact performance Nevo Hed via buildroot
2023-01-05  1:57 ` [Buildroot] [PATCH 1/1] " Nevo Hed via buildroot
2023-01-07 20:15   ` Yann E. MORIN [this message]
2023-01-12 10:20     ` Peter Korsgaard
2023-01-21 22:27   ` Yann E. MORIN
2023-01-22  9:13     ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230107201526.GA151997@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=nhed+buildroot@starry.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox