Hacker News new | ask | show | jobs
by dsissitka 1061 days ago
Perhaps a bit awkwardly named but nice:

> bun --smol is a new CLI flag which configures the JavaScriptCore heap size to be smaller and grow slower, at a cost to runtime performance. This is useful for running Bun in memory-constrained environments.

From the example they gave (https://i.imgur.com/IDHTaAh.png):

  Bun                343 MB
  Bun with --smol    54 MB
  Node.js            138 MB
4 comments

This is cool but I'm struggling to think of a case where I'd want to run backend JavaScript in a memory constrained environment, doubly so where performance isn't a concern.
I have an example for you. I self-host a Telegram bot, which is written in Python. However, I believe that if it were written in JavaScript, the situation would be similar.

The bot is rarely used, so on average, it only uses 0.06% of my machine's CPU power. However, it consumes 3% of the RAM at the same time. --smol switch according to Jarred's tests reduces memory usage ~7 times by increasing CPU usage just 2x times. In my case such redistribution of resource consumption would be a clear win!

To save RAM, I actually switched to a 32-bit Python base image. This switch resulted in a 30% reduction in RAM usage.

Full process/container isolation for many instances of untrusted code, perhaps? A serverless PaaS could use this to cut down significantly on the frequency of cold starts, all else being equal.
> This is cool but I'm struggling to think of a case where I'd want to run backend JavaScript in a memory constrained environment, doubly so where performance isn't a concern.

Maybe launching lots of separate services/containers locally, just to have the ability to debug everything and step through how a request travels through all of the services in one go, with multiple IDE instances also open locally, in addition to other stuff?

Distributed tracing is nice for remote environments, but having 5-20 IDE instances open with all of the related services can also provide a nice debugger experience. Not every machine has ample RAM for this, though, so I guess it's nice to have the option, without the processes/containers running into OOM so much?

The macbook air only has up to 16GB of memory right now. There's plenty of cases where one might want to run a javascript script on their laptop which uses quite a bit of memory, and they'd rather it complete at all, even if it's a bit slower.
My browser is already eating half of the 16 GiB of RAM I have on my laptop. I definitely don't need random small command-line tools which eat >300 MiB of overhead each. So far I am a happy non-user of Electron apps.
I would just change browsers.
I definitely have a M2 Air with 32GB. The point stands, but you aren't limited to 16GB on the Air
Can you point to that configuration in the apple store? I can't find _any_ M2 Air that can have more than 24Gb.
Oh yeah it's 24. Still higher than 16. My bad
Base M2 tops out at 24GB.
Uninformed spitballing here but I can totally imagine brewing up an eInk display that grabs X from the internet then draws something via the Canvas API. JavaScript would probably be a fine solution for that.
Sidecars perhaps. Don't bogart the memory.
Yeah, and how is this different from the behavior V8/JavaScriptCore would already have on a system with very little memory? Unless this actually makes it possible to run on lower-memory systems than before, I don’t really see how it’s helpful. Unused memory is wasted memory and all that. I hope it’s using every last byte, not letting memory sit unused.
I like it :) as long as there are clear descriptions and docs there could be more whimsy in software
Maybe I'm dating myself, but it took reading these comments for me to figure out that "smol" is pronounced "small" and not "es em oh el". Only after that did I think to Google it and find the dictionary.com slang entry [0].

If some significant portion of the user base is as slang-ignorant as I am (for example, most who speak English as a second language!), it'd be good to support both --small and --smol for mnemonic reasons. Remembering a series of letters that have no meaning to you is much harder than remembering a word that obviously relates to what you're trying to accomplish, and if I had landed on the bun docs first I would have continued pronouncing it "es em oh el".

[0] https://www.dictionary.com/e/slang/smol/

> “es em oh el”

I read this with a Spanish accent and it gave me a good laugh.

dictionary.com lies. It's pronounced 'smohl'. If it were pronounced the same as small then you couldn't use it conversationally.
Go nuts, but please make your silly stuff an alias if you must.
Wait, who decided all software is now Entreprise Edition (EE (tm)) focused?
This has nothing to do with enterprise, it's about accessibility. For most people on the planet English isn't even the first language and now you expect them to know about obscure wannabe-cutesy internet slang? Fuck that shit, what's next? UWU.md instead of README.md?
A --small flag would provide approximately the same amount of information - you'd still need to read the description to figure out what it does.

And thanks for the UWU.md idea, love it!

English isn't my first or even second language. --smol creates a lot of confusion in my head. It doesn't even make any sense. Why not --less-ram or similar?

What does UWU means? Why using an artificial language instead of established one?

To me, --small gives much more information. I immediately assume that it means something is smaller than the default, memory makes immediate sense. --smol on the other hand could be an acronym or a technical word I just don't know, the likelihood of random internet slang actually being one of the first interpretations seems low for most engineers.

Let's turn this around. If the flag was called --cutesy-wootesy-fartsy, would you still argue it's approximately the same amount of information? If not, can you explicitly explain why not?

[Scruffy voice] Second.

I'm writing out a bunch of notes for a technical screen in an UWU.md file right now (even if I'm definitely not shipping it to them like that)

People like you make me want to code only in Brainfuck.

This sort of gatekeeping over programming culture and aesthetic is only causing the community to further splinter between people with sticks up their asses and people who just want to have fun and enjoy life.

I don't see the limits in your ignorance. Bad names doesn't have anything in common with programming culture or aesthetic.
If weebs are in, then I am out. Consider this my final farewell. Mods don't even ban AYAYA anymore. 40 year old men thinking they are little anime girl. Thinking they are cuties
Why not? The audience is people who are deploying JS apps. Such people likely have access to the internet and are able to google "smol" if they want to know what it means. I'm not a first language speaker of English either, the system language on my phone is not English, if I google "smol" it immediately give me the translation into my system language. It takes no time at all.
Want to try again without a straw man?
Really odd since the logo design is around a pastry rather than a rabbit to mix such memey naming conventions.
It was originally supposed to be a bunny but the bao was cute so it’s kind of both now
Why is that odd? Why are you even talking about a rabbit?
Bun - bunny.
gives some strong early node.js vibes with all the precious and quirky naming schemes
do you have any examples from node.js?