2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 09:43:59 +08:00

scripts/bloat-o-meter: don't use readlines()

readlines() conses whole list before doing anything which is slower for
big object files.  Use per line iterator.

Speed up is ~2% on "allyesconfig" type of kernel.

    $ perf stat -r 16 taskset -c 15 ./scripts/bloat-o-meter ../vmlinux-000 ../obj/vmlinux >/dev/null
	...

  Before:  7.247708646 seconds time elapsed                ( +-  0.28% )
  After:   7.091202853 seconds time elapsed                ( +-  0.15% )

Link: http://lkml.kernel.org/r/20161119004143.GA1200@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alexey Dobriyan 2016-12-12 16:40:45 -08:00 committed by Linus Torvalds
parent 3fb4afd9a5
commit 3af06fd96a

View File

@ -18,8 +18,9 @@ if len(sys.argv) != 3:
def getsizes(file):
sym = {}
for l in os.popen("nm --size-sort " + file).readlines():
size, type, name = l[:-1].split()
with os.popen("nm --size-sort " + file) as f:
for line in f:
size, type, name = line.split()
if type in "tTdDbBrR":
# strip generated symbols
if name.startswith("__mod_"): continue