I have this queued for testing now.

Bruce

On Fri, Aug 30, 2019 at 1:09 AM Zhaolong Zhang <zhangzl2...@126.com> wrote:
>
> strip_common_prefix() is the hot path that executes on every input file.
> This patch sorts and uniqs the $include_paths by length descreasingly.
> And with the sorted $include_paths, the for-loop inside strip_common_prefix
> can break earlier, thus kernel_metadata task can be sped up by multiple times.
>
> Signed-off-by: Zhaolong Zhang <zhangzl2...@126.com>
> ---
>  tools/spp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/tools/spp b/tools/spp
> index 1150ff3..cba52bb 100755
> --- a/tools/spp
> +++ b/tools/spp
> @@ -125,6 +125,7 @@ strip_common_prefix()
>         if [ $this_len -lt $out_len ]; then
>             relocated_name=$t
>             out_len=$this_len
> +           break
>         fi
>         # add a trailing slash to get corner cases where one may
>         # have been added or not dropped
> @@ -133,6 +134,7 @@ strip_common_prefix()
>         if [ $this_len -lt $out_len ]; then
>             relocated_name=$t
>             out_len=$this_len
> +           break
>         fi
>      done
>
> @@ -297,6 +299,16 @@ infiles=$@
>
>  processed_files=""
>
> +# this function also removes duplicated lines by `sort -u`
> +sort_by_len_dec()
> +{
> +        for i in $@; do
> +                echo $i
> +        done | sort -u | awk '{ print length($0) " " $0; }' | sort -nr | cut 
> -d ' ' -f 2-
> +}
> +
> +include_paths=$(sort_by_len_dec $include_paths)
> +
>  ##
>  ## create variables for use in scripts
>  ##
> --
> 1.9.1
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to