WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Reducing TCZ extension at 68% of their original size  (Read 3542 times)

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Reducing TCZ extension at 68% of their original size
« on: August 18, 2021, 12:02:09 PM »
Hi all,

 I made some test using mksquashfs and I have tried some options. Included the compression alghorits.

 I have found very promising two of them lzma and xz. The last could be optimised for x86, arm, etc. ​I am not sure if the optimisation refers to the host or to the guest, I think the guest otherwise it would be automatically determined.

 However, these are the results:

90084 KB - ​original size
64780 KB - lzma size
64628 KB - ​xz size
61040 KB - ​xz x86 size
 
 How about the loading time? I took the boot time three times for each of them:

60.44, 56.80, 56.05 - original time
56.27, 54.60, 54.24 - xz time
55.66, 55.61, 55.05 - xz 86 time
failed to load extensions - lzma

 So the lzma should be discarded but xz preformed very well. I hope this helps. R-




Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #1 on: August 18, 2021, 12:54:22 PM »
I add the script that converts all tcz in a folder, only if recompression is required.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #2 on: August 18, 2021, 02:52:26 PM »
In the next release, zstd could be used instead of xz

To include tce based on zstd compression the libraries need to be added in rootfs.gz

This are a comparative benchmark of zstd

https://facebook.github.io/zstd/

Here the comparison between zstd vs xz

https://sysdfree.wordpress.com/2020/01/04/293/

I have tried with zstd compression:

96864 KB - original size
63800 KB - xz size
74544 KB - zstd size

but it does not seem to overbeat the xz which remain the best size-oriented


I hope this helps, -R
« Last Edit: August 18, 2021, 03:20:48 PM by Roberto A. Foglietta »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Reducing TCZ extension at 68% of their original size
« Reply #3 on: August 19, 2021, 03:55:02 AM »
If you search the forum, you will find all these have already been considered. You will also find they require greatly more RAM, preventing their use on low-end 32-bit systems.
The only barriers that can stop you are the ones you create yourself.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #4 on: August 19, 2021, 06:15:19 AM »
If you search the forum, you will find all these have already been considered. You will also find they require greatly more RAM, preventing their use on low-end 32-bit systems.

Searching in the forum I found this post that redirected me to Core Book

http://forum.tinycorelinux.net/index.php/topic,20545.msg128097.html#msg128097

It seems that xz will add 1MB of RAM for the dictionary for each extension, this is my system

- 55 extensions loaded
- 59 MB disk space for extensions
- 83 MB memory used (using xz)

Code: [Select]
roberto@vm-ubuntu18:~/tinycore-editor/tmp$ du -ks *
8 afterboot.sh
16857 boot
341 custom
3 extra
3 flags
31 patches
210 provides
5 sshkeys.pub
1 tcl-usb-boot-disable.gz
1 tcl-usb-boot-enable.gz
59114 tcz
roberto@vm-ubuntu18:~/tinycore-editor/tmp$ echo $[16857+59114]
75971
roberto@vm-ubuntu18:~/tinycore-editor/tmp$ ls -1 tcz/*.tcz | wc -l
55

root@box:~# free
              total        used        free      shared  buff/cache   available
Mem:         499276       83644      358316       21140       57316      381640
Swap:         97112           0       97112
root@box:~# df -h | grep tcloop | wc -l
55
« Last Edit: August 19, 2021, 06:19:36 AM by Roberto A. Foglietta »

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #5 on: August 19, 2021, 06:24:13 AM »
This is my system using original gzip extensions:

- 55 extensions loaded
- 90 MB disk space for extensions
- 47 MB memory used (original)

It seems that xz extensions suck 36MB of RAM, on average 660KB for each extension.

Code: [Select]
roberto@vm-ubuntu18:~/tinycore-editor/tmp$ du -ks tcz
90418 tcz

froot@box:~# free
              total        used        free      shared  buff/cache   available
Mem:         499276       47344      396108       21136       55824      417944
Swap:        109172           0      109172
« Last Edit: August 19, 2021, 06:28:15 AM by Roberto A. Foglietta »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: Reducing TCZ extension at 68% of their original size
« Reply #6 on: August 19, 2021, 09:21:30 AM »
@Roberto: The problem hard to over-come in Tinycore is that the design goal is for 32 bits, low/average CPU power (486) and low RAM (< 128 MB?)  <-- tiny!
 Of course THIS if good also for 64 Bits, average/powerful CPU, average/big RAM.

I think for "modern" machines, with >1 GB RAM and an i686 CPU (as are almost all NEW-BUY linux machine produced in the last 8 years) that optimized (special-purpose, home-made specific) scripts, could be produced for x86_64. But this involves different scripts for different architectures (arm / x86 / x86_64), which implies more maintenance.
FYI: 36 MB "wasted" for a machine with [1 - 2] GB RAM can be acceptable (xz compression in kernel), but not for old (second hand) machines still used in "3-rd" countries.

PS: most machines are designed to fail after few (max 6) years; with expensive  to replace (or hard to find) spare parts, so to force the "user" to buy new hardware.

EDIT: in tc ver. [8 -12] the Xorg.tcz drag with it near 102 other tcz. But combining all of them in a pseudo Xorg-full.tcz you get boot speed...(and not 1MB wasted on each Xorg dependency, if xz compressed tczs and kernel support to mount squshfs xz modules).
« Last Edit: August 19, 2021, 09:40:23 AM by nick65go »

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #7 on: August 19, 2021, 11:53:06 AM »
EDIT: in tc ver. [8 -12] the Xorg.tcz drag with it near 102 other tcz. But combining all of them in a pseudo Xorg-full.tcz you get boot speed...(and not 1MB wasted on each Xorg dependency, if xz compressed tczs and kernel support to mount squshfs xz modules).

Thanks for this suggestion, using unionfs-fuse to merge tcz I reduced my boot time from 55 seconds to 13 seconds!  :)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Reducing TCZ extension at 68% of their original size
« Reply #8 on: August 19, 2021, 11:59:10 AM »
Also, we did okay the other compression algos for x86_64. It's not required to use gzip when submitting 64-bit extensions.
The only barriers that can stop you are the ones you create yourself.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #9 on: August 19, 2021, 12:03:43 PM »
Also, we did okay the other compression algos for x86_64. It's not required to use gzip when submitting 64-bit extensions.

For x86_64 you might want use XZ for example. It takes RAM but x86_64 are plenty of that usually.

A the moment, I compressed 55 extensions in 4 meta packages: sshonly, usbkey, develop, git.

Very fast and and low RAM consuming: 20MB less than loading the original extensions separately!

Code: [Select]
root@box:~# free
              total        used        free      shared  buff/cache   available
Mem:         499276       26776      421200       20252       51300      439396
Swap:        102720           0      102720

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #10 on: August 19, 2021, 12:38:26 PM »
When I merge the tcz in a single tcz the installation scripts goes in the same directory but they are not executed probably because the name of the extention does not match any of them. This could be a problem. Do you know how to address it?

Code: [Select]
roberto@vm-ubuntu18:~/tinycore-editor/tinycore/tcz/tmp/usr/local/tce.installed$
total 3
drwxrwxr-x 2 root    staff  91 ott  5  2015 ./
drwxr-xr-x 9 root    root  145 nov  2  2018 ../
-rwxr-xr-x 1 roberto staff  69 ott  5  2015 binutils*
-rwxr-xr-x 1 roberto staff 399 mag 25  2017 ca-certificates*
-rwxr-xr-x 1 roberto staff 219 gen  3  2021 libtirpc*
-rwxr-xr-x 1 roberto staff 527 apr 28  2019 openssl-1.1.1*

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #11 on: August 19, 2021, 03:28:21 PM »
When I merge the tcz in a single tcz the installation scripts goes in the same directory but they are not executed probably because the name of the extention does not match any of them. This could be a problem. Do you know how to address it?

I have solved the problem improving the script which makes the merge of TCZs

https://github.com/robang74/tinycore-editor/blob/main/tinycore/tczmetamerge.sh

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Reducing TCZ extension at 68% of their original size
« Reply #12 on: August 20, 2021, 08:24:56 AM »
Also, we did okay the other compression algos for x86_64. It's not required to use gzip when submitting 64-bit extensions.

Hi Curaga, in my TinyCore Editor (Suite) the XZ compression takes places only if the architecture is x86_64

Thank you for the suggestion, -R