Bug 158383 - program/classes : store uncompressed classes in jar files for faster startup and smaller installation file
Summary: program/classes : store uncompressed classes in jar files for faster startup ...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.6.2.1 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: QA:needsComment
Keywords:
Depends on:
Blocks: Win-Installer-Smaller Installer-Linux
  Show dependency treegraph
 
Reported: 2023-11-26 20:11 UTC by Jérôme
Modified: 2023-12-25 03:10 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
simulating LZX compression of uncompressed jar files inside the MSI archive (2.92 MB, application/zip)
2023-11-30 20:05 UTC, Jérôme
Details
simulating LZX compression of original compressed jar files inside the MSI archive (5.99 MB, application/zip)
2023-11-30 20:10 UTC, Jérôme
Details
size of each original and uncompressed jar file (8.07 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-11-30 20:23 UTC, Jérôme
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jérôme 2023-11-26 20:11:02 UTC
Today, SSD disks offer low-latency access to file content and slightly higher throughput than traditional hard disks.
The Java virtual machine would skip the "deflate" step when loading classes. Overall class loading will be faster.

Storing uncompressed classes in jar files will also reduce the size of the installation archives, since only one compression will be applied to a concatenation of classes of the jar file (a larger data set for the compression). In addition, installation archives have more efficient compression methods than deflate (LZX in MSI archives, XZ in deb archives).

For example, with MSI archive on Windows :
1. classes are compressed with deflate into a jar file (separate compression for each class).
2. each jar file is compressed with LZX method.

I've just done a test by rebuilding jar files with uncompressed content. To estimate the impact on the size of the MSI archive, I built a zip file using the LZMA method (each jar is compressed in the same data set inside the zip file). I compared this zip file with a zip file created with the original jar files.
Comment 1 Jérôme 2023-11-30 20:05:28 UTC
Created attachment 191166 [details]
simulating LZX compression of uncompressed jar files inside the MSI archive

Each jar file in program/classes :
1. has been extracted using "jar xf [file name].jar"
2. has been created using "jar c0f [file name]-stored.jar *"

Next the whole program/classes folder has been packaged in a zip file with the below command line :
7z a -tzip -mm=LZMA -mx=9 -mmt=off stored-jars-LZMA.zip program/classes

jar version : jar (fastjar) 0.98
7-Zip version : [64] 16.02
Comment 2 Jérôme 2023-11-30 20:10:47 UTC
Created attachment 191167 [details]
simulating LZX compression of original compressed jar files inside the MSI archive

The whole program/classes folder has been packaged in a zip file with the below command line :
7z a -tzip -mm=LZMA -mx=9 -mmt=off original-jars-LZMA.zip program/classes

7-Zip version : [64] 16.02
Comment 3 Jérôme 2023-11-30 20:17:22 UTC
If the jar files in the programs/classes directory store the files without compression, the size of the MSI file would be reduced by around 3 MB.
Comment 4 Jérôme 2023-11-30 20:23:47 UTC
Created attachment 191170 [details]
size of each original and uncompressed jar file
Comment 5 Jérôme 2023-12-10 17:35:24 UTC
For the GNU/Linux/amd64 Debian packages, the jar files are in :
- libobasis7.6-core_7.6.4.1-1_amd64.deb
- libobasis7.6-extension-beanshell-script-provider_7.6.4.1-1_amd64.deb
- libobasis7.6-extension-javascript-script-provider_7.6.4.1-1_amd64.deb
- libobasis7.6-extension-report-builder_7.6.4.1-1_amd64.deb
- libreoffice7.6-ure_7.6.4.1-1_amd64.deb