#string-interning #string #interning #js #javascript

no-std boa_interner

String interner for the Boa JavaScript engine

10 releases (5 breaking)

0.19.1 Sep 12, 2024
0.19.0 Jul 11, 2024
0.18.0 Mar 7, 2024
0.17.3 Sep 26, 2023
0.14.0 Mar 15, 2022

#476 in Data structures

Download history 7958/week @ 2024-07-15 6558/week @ 2024-07-22 6544/week @ 2024-07-29 6978/week @ 2024-08-05 7576/week @ 2024-08-12 6264/week @ 2024-08-19 5632/week @ 2024-08-26 5918/week @ 2024-09-02 6076/week @ 2024-09-09 5581/week @ 2024-09-16 6629/week @ 2024-09-23 6068/week @ 2024-09-30 8169/week @ 2024-10-07 10560/week @ 2024-10-14 12136/week @ 2024-10-21 9495/week @ 2024-10-28

40,702 downloads per month
Used in 24 crates (3 directly)

Unlicense OR MIT

160KB
3K SLoC

Boa's boa_interner is a string interner for compiler performance.

Crate Overview

The idea behind using a string interner is that in most of the code, strings such as identifiers and literals are often repeated. This causes extra burden when comparing them and storing them. A string interner stores a unique usize symbol for each string, making sure that there are no duplicates. This makes it much easier to compare, since it's just comparing to usize, and also it's easier to store, since instead of a heap-allocated string, you only need to store a usize. This reduces memory consumption and improves performance in the compiler.

Dependencies

~2.4–3.5MB
~55K SLoC