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

no-std boa_interner

String interner for the Boa JavaScript engine

11 releases (6 breaking)

new 0.20.0 Dec 5, 2024
0.19.1 Sep 12, 2024
0.19.0 Jul 11, 2024
0.18.0 Mar 7, 2024
0.14.0 Mar 15, 2022

#242 in Data structures

Download history 6248/week @ 2024-08-21 5306/week @ 2024-08-28 6438/week @ 2024-09-04 5711/week @ 2024-09-11 6075/week @ 2024-09-18 6346/week @ 2024-09-25 6718/week @ 2024-10-02 8543/week @ 2024-10-09 11703/week @ 2024-10-16 11493/week @ 2024-10-23 8528/week @ 2024-10-30 9513/week @ 2024-11-06 9407/week @ 2024-11-13 10587/week @ 2024-11-20 11367/week @ 2024-11-27 8251/week @ 2024-12-04

41,469 downloads per month
Used in 25 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

~1.7–2.5MB
~45K SLoC