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

no-std boa_interner

String interner for the Boa JavaScript engine

8 releases (4 breaking)

0.18.0 Mar 7, 2024
0.17.3 Sep 26, 2023
0.17.0 Jul 8, 2023
0.16.0 Sep 25, 2022
0.14.0 Mar 15, 2022

#255 in Data structures

Download history 4184/week @ 2024-01-18 4207/week @ 2024-01-25 3585/week @ 2024-02-01 2867/week @ 2024-02-08 4214/week @ 2024-02-15 4418/week @ 2024-02-22 4786/week @ 2024-02-29 4522/week @ 2024-03-07 6011/week @ 2024-03-14 5383/week @ 2024-03-21 4122/week @ 2024-03-28 4937/week @ 2024-04-04 5931/week @ 2024-04-11 6567/week @ 2024-04-18 5378/week @ 2024-04-25 4890/week @ 2024-05-02

23,791 downloads per month
Used in 20 crates (4 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.3–3MB
~55K SLoC