public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Multithreaded compression with LZMA2
@ 2020-12-02  2:59 Daniel Schaefer
  2020-12-02  3:36 ` [edk2-devel] " Andrew Fish
  2020-12-03 10:24 ` Laszlo Ersek
  0 siblings, 2 replies; 12+ messages in thread
From: Daniel Schaefer @ 2020-12-02  2:59 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: derek.lin2

Hi everyone,

I'm looking into how to speed up the build process and noticed that our build
uses LZMA to encrypt the main firmware volume. Since it's quite big it takes a
while but only uses one CPU thread.

LZMA2 is a version of LZMA which can be multi-threaded and achieve much faster
compression times. I did a quick benchmark using the `xz` command-line tool,
which uses a modified version of the LZMA SDK that EDK2 uses. The results are:

Uncompressed size: 64M

| Algo  | Comp Time | Decomp Time | Size | Threads |
| ----- | --------- | ----------- | ---- | ------- |
| LZMA  |    19.67s |        0.9s | 9.1M |       1 |
| LZMA2 |    20.11s |        1.2s | 9.2M |       1 |
| LZMA2 |     8.31s |        1.0s | 9.4M |       4 |

Using those commands:

time xz --format=lzma testfile
time unlzma testfile.lzma

time xz --lzma2 testfile
time unxz testfile.xz

time xz -T4 --lzma2 testfile
time unxz testfile.xz

This is quite a significant improvement of build time, while decompression time
and size only slightly increase. If that's a concern, then LZMA2 could be used
for development only.

I haven't investigated the details of how to support this in the code but it
appears to be a simple change, since the LZMA SDK that we use already supports
LZMA2.

What do you think?

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-12-08  6:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-02  2:59 Multithreaded compression with LZMA2 Daniel Schaefer
2020-12-02  3:36 ` [edk2-devel] " Andrew Fish
2020-12-02  5:21   ` 回复: " gaoliming
2020-12-02  8:24     ` Daniel Schaefer
2020-12-03 10:24 ` Laszlo Ersek
2020-12-03 12:11   ` Daniel Schaefer
2020-12-03 15:57     ` Bret Barkelew
2020-12-04  8:19       ` Daniel Schaefer
2020-12-03 23:35     ` Laszlo Ersek
2020-12-04  2:28       ` 回复: " gaoliming
2020-12-04  9:02         ` Daniel Schaefer
2020-12-08  6:01           ` 回复: " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox