[Buildroot] [PATCH v2 5/6] support/scripts/pkg-stats: don't buffer whole file searching for infra
Thomas Perale
thomas.perale at mind.be
Fri May 15 17:46:32 UTC 2026
In reply of:
> The file handle can be iterated over directly and each line is used
> exactly once, so the only effect of reading all lines into a list
> first was higher memory use and complexity.
>
> Signed-off-by: Fiona Klute <fiona.klute at gmx.de>
Applied to 2025.02.x & 2026.02.x. Thanks
> ---
> support/scripts/pkg-stats | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index bbd1e3e6f0..5dcc812e2b 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -197,8 +197,7 @@ class Package:
>
> self.infras = list()
> with open(self.pkgfile, 'r') as f:
> - lines = f.readlines()
> - for line in lines:
> + for line in f:
> match = INFRA_RE.match(line)
> if not match:
> continue
> --
> 2.53.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
More information about the buildroot
mailing list