@@ -53,63 +53,17 @@ ptr --> <var int length> <data>
5353
5454![ string_memory] ( https://github.com/user-attachments/assets/25f5acf8-9a3e-4a4c-b2f1-b2fb972cc9c8 )
5555
56- ## Measured from System Memory
56+ ## Memory Usage Comparison (RSS per String)
5757
58- ### 0..=4
59- ``` text,ignore
60- Crate, len 0..=4 | RSS (B) | Virtual (B)
61- -------------------|--------------|-------------
62- std | 36.9 | 38.4
63- smol_str | 24.0 | 24.0
64- compact_str | 24.0 | 24.0
65- compact_string | 24.1 | 26.2
66- cold-string | 8.0 | 8.0
67- ```
68-
69- ### 0..=8
70- ``` text,ignore
71- Crate, len 0..=8 | RSS (B) | Virtual (B)
72- -------------------|--------------|-------------
73- std | 38.4 | 40.0
74- smol_str | 24.0 | 24.0
75- compact_str | 24.0 | 24.0
76- compact_string | 25.8 | 27.8
77- cold-string | 11.2 | 11.7
78- ```
79-
80- ### 0..=16
81- ``` text,ignore
82- Crate, len 0..=16 | RSS (B) | Virtual (B)
83- -------------------|--------------|-------------
84- std | 46.8 | 48.6
85- smol_str | 24.0 | 24.1
86- compact_str | 24.0 | 24.0
87- compact_string | 32.6 | 34.9
88- cold-string | 24.9 | 26.7
89- ```
90-
91- ### 0..=32
92- ``` text,ignore
93- Crate, len 0..=32 | RSS (B) | Virtual (B)
94- -------------------|--------------|-------------
95- std | 55.3 | 57.4
96- smol_str | 41.1 | 42.1
97- compact_str | 35.4 | 36.6
98- compact_string | 40.5 | 42.9
99- cold-string | 36.5 | 38.8
100- ```
101-
102- ### 0..=64
103- ``` text,ignore
104- Crate, len 0..=64 | RSS (B) | Virtual (B)
105- -------------------|--------------|-------------
106- std | 71.4 | 73.7
107- smol_str | 72.2 | 74.3
108- compact_str | 61.0 | 63.3
109- compact_string | 56.5 | 59.1
110- cold-string | 53.5 | 56.3
111- ```
58+ | Crate | 0–4 chars | 0–8 chars | 0–16 chars | 0–32 chars | 0–64 chars |
59+ | :--- | :---: | :---: | :---: | :---: | :---: |
60+ | ` std ` | 36.9 B | 38.4 B | 46.8 B | 55.3 B | 71.4 B |
61+ | ` smol_str ` | 24.0 B | 24.0 B | 24.0 B | 41.1 B | 72.2 B |
62+ | ` compact_str ` | 24.0 B | 24.0 B | 24.0 B | 35.4 B | 61.0 B |
63+ | ` compact_string ` | 24.1 B | 25.8 B | 32.6 B | 40.5 B | 56.5 B |
64+ | ** ` cold-string ` ** | ** 8.0 B** | ** 11.2 B** | ** 24.9 B** | ** 36.5 B** | ** 53.5 B** |
11265
66+ ** Note:** Columns represent string length (bytes/chars). Values represent average Resident Set Size (RSS) in bytes per string instance. Measurements taken with 10M iterations.
11367
11468## License
11569
0 commit comments