WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: smaller/faster core base, by using [exp] || comnands in tc-config?  (Read 2798 times)

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Hi, is any gain to replace (in /etc/init.d/tc-config) few statements like
Code: [Select]
if [ -n "$MYDATA" ]; then
echo "$MYDATA" > /etc/sysconfig/mydata
else
echo "mydata" > /etc/sysconfig/mydata
fi

with something like:
Code: [Select]
[ -n "$MYDATA" ] || echo $MYDATA > /etc/sysconfig/mydata
the gain could be 56 bytes instead of 112 bytes;  we loose 2 inodes; anyway will be compressed in core.cpio
but we have the chance to not execute one echo, if no bootcode mydata is provided.

there are other pieces of code like that, if the idea could be accepted to have small/empty files (like /etc/sysconfig/mydata) directly into the core.

ex:
Code: [Select]
# If desktop is specified use that
if [ -n "$DESKTOP" ]; then
echo "$DESKTOP" > /etc/sysconfig/desktop
else
[ -s /etc/sysconfig/desktop ] && DESKTOP=`cat /etc/sysconfig/desktop`
fi

we can pre-populate /etc/sysconfig/desktop with flwm string; so if no desktop will be present , then the file will be ignored anyway...
« Last Edit: May 09, 2019, 12:08:29 PM by nick65go »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: smaller/faster core base, by using [exp] || comnands in tc-config?
« Reply #1 on: May 09, 2019, 02:00:43 PM »
The general idea is good. Though the speed difference will be very small.

For $DESKTOP, it would be a behavioral change, I think.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: smaller/faster core base, by using [exp] || comnands in tc-config?
« Reply #2 on: May 09, 2019, 02:04:36 PM »
Hi nick65go
If you place this at the top of the file where a bunch of other variables are defined:
Code: [Select]
MYDATA="mydata"and change this:
Code: [Select]
if [ -n "$MYDATA" ]; then
echo "$MYDATA" > /etc/sysconfig/mydata
else
echo "mydata" > /etc/sysconfig/mydata
fi
to this:
Code: [Select]
echo "$MYDATA" > /etc/sysconfig/mydataThen the number of bytes required drops from 113 to 55, no conditional testing is required, and no inodes are consumed.

I'd be careful about messing with the DESKTOP logic.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: smaller/faster core base, by using [exp] || comnands in tc-config?
« Reply #3 on: May 09, 2019, 02:47:46 PM »
Hi, thanks for your replays. Yes there are many variants to implement smaller code, and the gains are near insignificant in NORMAL environment like under native linux, as I do at home. Unfortunately at the daily job, which is not related to IT, I am forced to use Windows_10 (I hate it!), without acceleration for Intel CPU (I have no right to install drivers, or virtual machines, etc). So Qemu 3.1 (installed/copied by hand :) is the way to enjoy my spare/lunch time. And is extremely slow.
So yes, any small improvements matter for my hobby -Tinycore. (I am not a developer).

I can easy modify my own core, no problem. But I still like to see TC as the minimalism. Otherwise Alpine Linux, with its automatic/systematic/fast build from sources by scripts and up-to-date regarding security patches is the next in  line.

The main idea, without annoying the developers, was that core/tinycore should be as small as possible. Originally Tinycore -2.11.6.iso was near 10.4 MB, now Tinycore-10.0.iso is over 18.4MB. The small size was archived by Robert using powerful tools like ash/sed/grep/awk. The "transition/compatibility" to bash make the code more clear but a little bigger.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: smaller/faster core base, by using [exp] || comnands in tc-config?
« Reply #4 on: May 09, 2019, 04:39:06 PM »
Hi nick65go
... The small size was archived by Robert using powerful tools like ash/sed/grep/awk. The "transition/compatibility" to bash make the code more clear but a little bigger.
Unless something changed in TC10, Tinycore still uses  ash  and not  bash. In fact, the system scripts use the busybox versions
of ash, sed, grep, and awk. Take a look at the  useBusybox  function in  /etc/init.d/tc-functions.

Offline mocore

  • Hero Member
  • *****
  • Posts: 667
  • ~.~
Re: smaller/faster core base, by using [exp] || comnands in tc-config?
« Reply #5 on: May 09, 2019, 05:02:54 PM »
Originally Tinycore -2.11.6.iso was near 10.4 MB, now Tinycore-10.0.iso is over 18.4MB.

Quote from: tinycorelinux.net/*.x/release/distribution_files/$kernel
tinycorelinux.net/10.x/x86/release/distribution_files/vmlinuz - 4295328

 tinycorelinux.net/4.x/x86/release/distribution_files/vmlinuz  -  2491968

 tinycorelinux.net/2.x/release/distribution_files/bzImage - 1994736

it appears Linux(+modules) is growing



Offline xor

  • Hero Member
  • *****
  • Posts: 1268
Re: smaller/faster core base, by using [exp] || comnands in tc-config?
« Reply #6 on: May 10, 2019, 12:35:32 AM »
Originally Tinycore -2.11.6.iso was near 10.4 MB, now Tinycore-10.0.iso is over 18.4MB.

Quote from: tinycorelinux.net/*.x/release/distribution_files/$kernel
tinycorelinux.net/10.x/x86/release/distribution_files/vmlinuz - 4295328

 tinycorelinux.net/4.x/x86/release/distribution_files/vmlinuz  -  2491968

 tinycorelinux.net/2.x/release/distribution_files/bzImage - 1994736

it appears Linux(+modules) is growing

https://www.subsecret.dk/wiki/Linux_on_Amiga

Theoretically
the world's fastest operating system size;
the processor cache must be half the size.
Cache is faster than ramden
« Last Edit: May 10, 2019, 12:55:20 AM by xor »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: smaller/faster core base, by using [exp] || comnands in tc-config?
« Reply #7 on: May 10, 2019, 06:04:39 AM »
Quote
https://www.subsecret.dk/wiki/Linux_on_Amiga
Theoretically the world's fastest operating system size; the processor cache must be half the size.

Hi XOR, if you realy want to see something briliant, try the english version of the rusian kolibri linux :)
https://en.wikipedia.org/wiki/KolibriOS
It is not about the minimal size for kernel only, what matter is the usefulness of the full system.
In the end it should not matter if it is linux/windows/macOS/etc as the scheleton for the drivers, or libc/musli for C library, or what kind of windows manager . The user needs applications: text editor, video/audio player, internet browser, pdf reader etc. Kolibri has all of them in the smallest size!

Back to the minimalist core, the key idea was to keep compatibility (busybox vs. toybox, libc vs. musli) with a big team of developers which can produce UPDATED compiled aplications from the shelf (no need to compile it yourself, they use farms of cloud servers).
Otherwise we can "build" our own "distribution" from lego pieces kernel + libs+ apps, from big repositories.