Most active commenters
  • necovek(8)
  • rixed(3)
  • nicoburns(3)

←back to thread

239 points ivankra | 38 comments | | HN request time: 0.51s | source | bottom
1. bcardarella ◴[] No.45945551[source]
Just a small comparison, compiled for release:

Boa: 23M Brimstone: 6.3M

I don't know if closing the gap on features with Boa and hardening for production use will also bloat the compilation size. Regardless, for passing 97% of the spec at this size is pretty impressive.

replies(3): >>45945705 #>>45945748 #>>45950091 #
2. embedding-shape ◴[] No.45945705[source]
Is that with any other size optimizations? I think by default, most of them (like codegen-units=1, remove panic handling, etc) are tuned for performance, not binary size, so might want to look into if the results are different if you change them.
replies(2): >>45945756 #>>45946354 #
3. jerf ◴[] No.45945748[source]
It looks like Boa has Unicode tables compiled inside of itself: https://github.com/boa-dev/boa/tree/main/core/icu_provider

Brimstone does not appear to.

That covers the vast bulk of the difference. The ICU data is about 10.7MB in the source (boa/core/icu_provider) and may grow or shrink by some amount in the compiling.

I'm not saying it's all the difference, just the bulk.

There's a few reasons why svelte little executables with small library backings aren't possible anymore, and it isn't just ambient undefined "bloat". Unicode is a big one. Correct handling of unicode involves megabytes of tables and data that have to live somewhere, whether it's a linked library, compiled in, tables on disks, whatever. If a program touches text and it needs to handle it correctly rather than just passing it through, there's a minimum size for that now.

replies(6): >>45945844 #>>45945976 #>>45946210 #>>45947165 #>>45947379 #>>45951653 #
4. LtdJorge ◴[] No.45945756[source]
Stripping can save a huge amount of binary size, there’s lots of formatting code added for println! and family, stacktrace printing, etc. However, you lose those niceties if stripping at that level.
5. twoodfin ◴[] No.45945844[source]
As well-defined as Unicode is, surprising that no one has tried to replace ICU with a better mousetrap.

Not to say ICU isn’t a nice bit of engineering. The table builds in particular I recall having some great hacks.

replies(1): >>45946706 #
6. rixed ◴[] No.45945976[source]
I was currious to see what that data consisted of and aparently that's a lot of translations, like the name of all possible calendar formats in all possible languages, etc. This seems useless in the vast majority of use cases, including that of a JS interpreter. Looks to me like the typical output of a comitee that's looking too hard to extend its domain.

Disclaimer: I never liked unicode specs.

replies(1): >>45946669 #
7. ambicapter ◴[] No.45946210[source]
Unicode is everywhere though. You'd think there'd be much greater availability of those tables and data and that people wouldn't need to bundle it in their executables.
replies(1): >>45946487 #
8. bcardarella ◴[] No.45946354[source]
I only ran both with `cargo build --release`
9. nicoburns ◴[] No.45946487{3}[source]
Unfortunately operating systems don't make the raw unicode data available (they only offer APIs to query it in various ways). Until they do we all have to ship it seperately.
replies(2): >>45949837 #>>45951294 #
10. necovek ◴[] No.45946669{3}[source]
Unicode is an attempt to encode the world's languages: there is not much to like or dislike about it, it only represents the reality. Sure, it has a number of weird details, butnif anything, it's due to the desire to simplify it (like Han unification or normal forms).

Any language runtime wanting to provide date/time and string parsing functions needs access to the Unicode database (or something of comparable complexity and size).

Saying "I don't like Unicode" is like saying "I don't like the linguistic diversity in the world": I mean sure, OK, but it's still there and it exists.

Though note that date-time, currency, number, street etc. formatting is not "Unicode" even if provided by ICU: this is similarly defined by POSIX as "locales", anf GNU libc probably has the richest collection of locales outside of ICU.

There are also many non-Unicode collation tables (think phonebook ordering that's different for each country and language): so no good sort() without those either.

replies(5): >>45947061 #>>45947293 #>>45947427 #>>45952195 #>>45952348 #
11. necovek ◴[] No.45946706{3}[source]
POSIX systems actually have their own approach with "locales" and I it predates Unicode and ICU.

Unfortunately, for a long time, POSIX system were uncommon on desktops, and most Unices do not provide a clean way to extend it from userland (though I believe GNU libc does).

12. ◴[] No.45947061{4}[source]
13. jancsika ◴[] No.45947165[source]
If someone builds, say, a Korean website and needs sort(), does the ICU monolith handle 100% of the common cases?

(Or substitute for Korean the language that has the largest amount of "stuff" in the ICU monolith.)

replies(1): >>45947451 #
14. xeonmc ◴[] No.45947293{4}[source]
Does that include emojis?
replies(1): >>45947489 #
15. HansHalverson ◴[] No.45947379[source]
Brimstone does embed Unicode tables, but a smaller set than Boa embeds: https://github.com/Hans-Halverson/brimstone/tree/master/icu.

Brimstone does try to use the minimal set of Unicode data needed for the language itself. But I imagine much of the difference with Boa is because of Boa's support for the ECMA-402 Internationalization API (https://tc39.es/ecma402/).

replies(1): >>45947661 #
16. adzm ◴[] No.45947451{3}[source]
Yes, though it's easy to not use the ICU library properly or run into issues wrt normalization etc
17. jcranmer ◴[] No.45947489{5}[source]
Emojis are complicated from a font rendering perspective. But from a string processing perspective, they're generally going to be among the simplest characters: they don't have a lot of complex properties with a lot of variation between individual characters. Compare something like the basic Latin characters, where the mappings for precomposed characters are going to vary wildly from 'a' to 'b' to 'c', etc., whereas the list of precomposed characters for the emoji blocks amounts to "none."
replies(2): >>45947902 #>>45950667 #
18. nekevss ◴[] No.45947661{3}[source]
Yeah, the majority of the difference is from the Unicode data for Intl along with probably the timezone data for Temporal.
replies(1): >>45948009 #
19. necovek ◴[] No.45947902{6}[source]
Agreed!

FWIW, they are not even "complicated" from a font rendering perspective: they're simple non-combining characters and they are probably never used in ligatures either (though nothing really stops you; just like you can have locale-specific variants with locl tables). It's basically "draw whatever is in a font at this codepoint".

Yes, if you want to call them out based on Unicode names, you need to have them in the database, and there are many of them, so a font needs to have them all, but really, they are the simplest of characters Unicode could have.

replies(3): >>45948028 #>>45948245 #>>45951571 #
20. nicoburns ◴[] No.45948009{4}[source]
Is it possible to build Boa without these APIs?
replies(1): >>45950999 #
21. nicoburns ◴[] No.45948028{7}[source]
"draw whatever is in a font at this codepoint" is doing quite a lot of work there. Some emoji fonts just embed a PNG which is easy. But COLRv1 fonts define an entire vector graphics imaging model which is similar what you need to render an SVG.
replies(1): >>45948157 #
22. kibwen ◴[] No.45948157{8}[source]
Yes, but at this point we're completely outside the scope of Unicode, which has nothing to do with how anything actually gets drawn to the screen.
23. overfeed ◴[] No.45948245{7}[source]
> they're simple non-combining characters

Skin-tone emoji's are combined characters: base emoji + tone.

replies(1): >>45951462 #
24. pabs3 ◴[] No.45949837{4}[source]
Debian has a unicode-data package, so you can just depend on it.
25. martin-t ◴[] No.45950091[source]
I was gonna say the last few percent might increase the size disproportionally as the last percent tend to do[0] but looks like boa passes fewer tests (~91%).

This is something I notice in small few-person or one-person projects. They don't have the resources to build complex architectures so the code ends up smaller, cleaner and easier to maintain.

The other way to look at it is that cooperation has an overhead.

[0]: The famous 80:20 rule. Or another claiming that each additional 9 in reliability (and presumably other aspects) takes the same amount of work.

26. nine_k ◴[] No.45950667{6}[source]
Sorry, what? You mean, emoji composition rules are simpler than combining diacritics? https://blog.codepoints.net/emojis-under-the-hood.html
replies(1): >>45951489 #
27. nekevss ◴[] No.45950999{5}[source]
For the engine, the answer is yes, Intl and Temporal are feature flagged due to the dependencies. What I suspect they’re comparing above is the CLIs, which is completely different than the engine. I’d have to double check for the CLI. If I recall correctly, we include all features in the CLI by default.
28. lifthrasiir ◴[] No.45951294{4}[source]
For some OSes like Windows, some relevant APIs can be indeed used to reconstruct those tables. I found that this is in fact viable for character encoding tables, only requiring a small table for fixes in most cases.
29. necovek ◴[] No.45951462{8}[source]
TIL, thanks for pointing it out.
30. necovek ◴[] No.45951489{7}[source]
I was unaware of this: thanks for pointing it out!
31. SkiFire13 ◴[] No.45951571{7}[source]
To add to the skintone emojis example, country flags emojis are combined characters using two letter characters corresponding to the country code. The various "family" emojis are also combined characters of individual person emojis, and so on.
32. miki123211 ◴[] No.45951653[source]
I just wish we could use system tables for that, instead of bloating every executable with their own outdated copy.

I have no issue with my system using an extra 10mb for Ancient Egyptian capitalization to work correctly. Every single program including those rules is a lot more wasteful.

33. rixed ◴[] No.45952195{4}[source]
I am not questionning the goal of representing all the fine details of every possible languages and currencies and calendars in use anywhere at any time in the universe, that's a respectable achievment. I'm discussing the process that lead to a programming language interpreter needing, according to the comment I was replying to, to embed that trove of data.

Most of us are not using computers to represent subtle variants of those cultural artifacts and therefore they should be left in some specialized libraries.

Computers are symbolic machines, after all, and many times we would be as good using only 16 symbols and typing our code on a keyboard with just that many keys. We can't have anything but 64bits floats in JS, but somehow we absolutely need to be able to tell between the "peso lourd argentin (1970–1983)" and the "peso argentin (1881–1970)"? And that to display a chemical concentration in millimole per liter in German one has to write "mmol/l"?

I get it, the symbolic machines need to communicate with humans, who use natural languages written in all kind of ways, so it's very nice to have a good way to output and input text. We wanted that way to not favor any particular culture and I can understand that. But how do you get from there to the amount of arcane specialized minute details in the ICU dataset is questionable.

replies(1): >>45976775 #
34. animuchan ◴[] No.45952348{4}[source]
> Saying "I don't like Unicode" is like saying "I don't like the linguistic diversity in the world": I mean sure, OK, but it's still there and it exists.

Respectfully disagree, linguistic diversity isn't by definition impossible to create a good abstraction on top of; I think that it's more of a failure of this particular attempt.

replies(1): >>45952779 #
35. necovek ◴[] No.45952779{5}[source]
Care to point out a -- by your definition -- successful attempt to do it?
36. necovek ◴[] No.45976775{5}[source]
You bring up numbers, but you ignore the strings, another fundamental data type in all programming languages.

Without this trove of data, you can't do something as simple as length(str) or uppercase(str) — even in a CLI if you want to line text up.

So yes, this database has a big chunk that represents rarely useful data like you mention. But majority of it is still generally useful.

replies(1): >>45977089 #
37. rixed ◴[] No.45977089{6}[source]
I may be wrong, but a cursory look at the data gave me the impression that the actual majority of that data was actually not related to dealing with commonplace string manipulations. Other than that, we probably agree.
replies(1): >>45985428 #
38. necovek ◴[] No.45985428{7}[source]
The big one that's often ignored are collation tables: while there's the default in ISO 10646 IIRC, each region-language combo might have their specific overrides (imagine "ss" being sorted as a separate letter in German, and not as after "sr" and before "st", so it would be sa..., sb..., sr..., st..., ssa..., ssb... etc); and then Austrian German might have a different phonebook ordering.