Replies: 5 comments 22 replies
-
|
You are not the first one to ask, but IMHO the usefulness of the project is greatly diminished by losing those. If it was just some ifdefs I wouldn't mind supporting it, the problem is that the JS bundle also needs adjusting because the REPL stores its history in sqlite, localStorage is backed by it, etc. |
Beta Was this translation helpful? Give feedback.
-
|
hi! this seems to be closely related: #514 |
Beta Was this translation helpful? Give feedback.
-
|
I tried quickly some benchmarks, I just wanted to see comparisons of various builds (based on my draft PR #962): Target machine of record: macOS arm64, Apple M1, 8 cores, Apple clang 21, Unix Makefiles/Ninja. Build configurationsBaseline
All configs also inherit Binary size
Startup latency (warm)
Runtime throughput
Throughput is min-ms (lower=faster) except octane (score, higher=better) and Score/MB (octane per binary MB, higher=more efficient). Δ% vs full (negative ms = faster; negative octane = slower):
Peak RSS (throughput workload)
|
Beta Was this translation helpful? Give feedback.
-
|
Fable found another interesting finding how to reduce compiled file size. With it we should get under 2 MB (for macOS). 1. Deduplicate the CA bundle — ~220 KiB, zero risk
bloaty attributes 439 KiB to Fix: move the definition into a new Touch points: 3. Compress the CA bundle with miniz — ~100–110 KiB (after 1.)miniz is linked unconditionally (lws is built with
I will not include it into my PR #962 since I think it's already quite a big. |
Beta Was this translation helpful? Give feedback.
-
|
with this build: cmake -B build-smallest \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DBUILD_WITH_WASM=OFF \
-DBUILD_WITH_SQLITE=OFF \
-DBUILD_WITH_TLS=OFF \
-DBUILD_WITH_FFI=OFF \
-DBUILD_WITH_MIMALLOC=OFF \
-DBUILD_WITH_OZ=ON \
-DBUILD_WITH_LTO=ON \
-DBUILD_WITH_GC_SECTIONS=ON \
-DBUILD_WITH_HIDDEN_VISIBILITY=ON \
-DBUILD_WITH_ICF=ON \
-DBUILD_WITH_STRIP=ON \
-DBUILD_WITH_NO_UNWIND_TABLES=ON
cmake --build build-smallest
outpus size for me (on macOS) is 1,8 MB % du -h build*/tjs | sort
1.8M build-smallest/tjs
5.7M build/tjs |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I had an idea to make tjs even smaller :) So I asked AI for help and it creates one .patch file to apply and then
make.The patch did exclude
sqliteandwasm... and it works for me.Maybe someone (like me) desn't need bundled
sqliteandwasm. Smaller binary size means faster cold start, right? I didn't measured it. But I like this idea to have very lightweight version of txiki.jsthe final compiled binary
tjsreduced from 6,4MB to 4MB.here is the patch (click to expand it):
applied using:
git apply "${patchFile}"//update:
This solution is rough POC and probably not widely usable, just some example working for me and maybe some reference or starting point for others.
I don't know how to achieve it in more intuitive way.
I don't expect it should be supported in core txiki.js, I just wanted to share an idea and how make already lightweight JS runtime even more lightweight :)
Beta Was this translation helpful? Give feedback.
All reactions