[Git-commits] [grml/grml-hwinfo] 2801c0: Reduce execution time by ~60% by dropping dpkg cal...

Michael Prokop noreply at github.com
Mon Aug 5 14:04:38 CEST 2024


  Branch: refs/heads/master
  Home:   https://github.com/grml/grml-hwinfo
  Commit: 2801c01c4badaa28843468035687dc0b45ee356d
      https://github.com/grml/grml-hwinfo/commit/2801c01c4badaa28843468035687dc0b45ee356d
  Author: Michael Prokop <mika at grml.org>
  Date:   2024-08-05 (Mon, 05 Aug 2024)

  Changed paths:
    M grml-hwinfo

  Log Message:
  -----------
  Reduce execution time by ~60% by dropping dpkg call to get kernel information

We're already collecting the information about the Debian package
"linux-image-$(uname -r)" in file `running_kernel`. We're only appending
output of `dpkg -S "/boot/vmlinuz-$(uname -r)` to the very same file,
and "/boot/vmlinuz-$(uname -r)" should and usually corresponds to the
same Debian package. But executing `dpkg -S ...` takes *long* during its
initial run.

Executing:

  dpkg -l "linux-image-$(uname -r)"

... takes less than a second on a freshly booted live system.

While:

  dpkg -S "/boot/vmlinuz-$(uname -r)"

can take >30 seconds on its first execution.

We're also already collecting information about running kernel version
in file `uname`. Since execution of grml-hwinfo should be fast, and the
potential benefit of getting the information of `dpkg -S
"/boot/vmlinuz-$(uname -r)"` is quite minimal, let's drop it.

Instead we reduce execution time of grml-hwinfo from ~52 seconds to
~19 seconds (average of three runs with freshly booted system each),
so effectively reducing runtime by ~60%.

Closes: grml/grml-hwinfo#13



To unsubscribe from these emails, change your notification settings at https://github.com/grml/grml-hwinfo/settings/notifications


More information about the Git-commits mailing list