From 07f7ad9898d2412b66fec4492cc89d59063bdfd8 Mon Sep 17 00:00:00 2001 From: Fiona Klute Date: Sun, 26 Apr 2026 17:33:33 +0200 Subject: [PATCH] support/scripts/pkg-stats: don't buffer whole file searching for infra 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 Signed-off-by: Arnout Vandecappelle --- 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