[Buildroot] [git commit branch/2026.02.x] support/scripts/pkg-stats: don't buffer whole file searching for infra
Thomas Perale
thomas.perale at mind.be
Fri May 15 14:22:25 UTC 2026
commit: https://gitlab.com/buildroot.org/buildroot/-/commit/071ba58f000d528b3d8b02dae808a5ada45452a5
branch: https://gitlab.com/buildroot.org/buildroot/-/tree/2026.02.x
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>
Signed-off-by: Arnout Vandecappelle <arnout at rnout.be>
(cherry picked from commit 07f7ad9898d2412b66fec4492cc89d59063bdfd8)
Signed-off-by: Thomas Perale <thomas.perale at mind.be>
---
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
More information about the buildroot
mailing list