Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimal Bun build? #2541

Open
leeoniya opened this issue Apr 3, 2023 · 10 comments
Open

minimal Bun build? #2541

leeoniya opened this issue Apr 3, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@leeoniya
Copy link

leeoniya commented Apr 3, 2023

What is the problem this feature would solve?

Bun binary big

What is the feature you are proposing to solve the problem?

are there any plans to make Bun itself strippable of features that are unused by some set of scripts?

how much can the binary shrink if it only included JSC and things required for e.g. sqlite3, fs, tcp/http. how small can it be with just stdout support: console.log("hello world!")?

What alternatives have you considered?

Node.js
Tauri
Neutralinojs
NW.js
Electron

@leeoniya leeoniya added the enhancement New feature or request label Apr 3, 2023
@Jarred-Sumner
Copy link
Collaborator

around 50% of the binary size on Linux is libicu which JavaScriptCore needs

@paulocoghi
Copy link

Out of curiosity. Do you believe UTF++ could be an alternative to libicu?

In addition to being lightweight, it is about 2x faster than libicu:

The performance of ICU, UTFPP, and libiconv were compared for the conversion of 9000 code points covering most languages with 10,000 iterations for all pairwise conversions between UTF8, UTF16, and UTF32.

Library Time (seconds)
ICU (C++) 2.120
libiconv 2.795
UTFPP 1.201

@Jarred-Sumner
Copy link
Collaborator

If it correctly implements the same interface/symbols for functions used by JavaScriptCore then definitely open to trying alternatives

@paulocoghi
Copy link

I apologize, because my research wasn't profound enough and UTF++ probably won't suit Bun's use case.

@Ristovski
Copy link

Perhaps Bun could provide a trimmed build using something like Nodes icutrim?

https://github.com/nodejs/node/tree/main/tools/icu:

icu_small.json controls the "small" (English only) ICU. It is input to icutrim.py

@jeltz
Copy link

jeltz commented Jun 9, 2023

There is also ICU4x which might be worth looking into. It is supposed to be modular so it can be used in resource contained environments.

https://github.com/unicode-org/icu4x

@paulocoghi
Copy link

Wow, thanks for the suggestion, @jeltz . I read the announcing article of ICU4X, and it seems a good candidate.

  • created and maintained by the same org
  • availability and ease of use in multiple programming languages
  • small, lightweight and portable (doesn't depend of external libraries)
  • uses little RAM and CPU (which could contribute to lower Bun resource usage even more)

@billywhizz

This comment has been minimized.

@AwakeningLightning
Copy link

There is also ICU4x which might be worth looking into. It is supposed to be modular so it can be used in resource contained environments.

https://github.com/unicode-org/icu4x

Seems good, hope it gets implemented.

@7heMech
Copy link

7heMech commented Nov 24, 2024

I wonder how much smaller it is tho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants