#thread-safe #atom #string #pi #memory #pool #reduce

pi_atom

The global thread safe atomic string pool reduces the memory occupation of the same string and is also used for HashMap keys

13 unstable releases (3 breaking)

0.5.3 Mar 13, 2024
0.5.0 Nov 7, 2023
0.2.6 Mar 27, 2024
0.2.4 Apr 17, 2023
0.1.0 Mar 1, 2022

#194 in Concurrency

Download history 53/week @ 2024-02-18 80/week @ 2024-02-25 273/week @ 2024-03-03 276/week @ 2024-03-10 74/week @ 2024-03-17 209/week @ 2024-03-24 154/week @ 2024-03-31 52/week @ 2024-04-07 44/week @ 2024-04-14 54/week @ 2024-04-21 47/week @ 2024-04-28 55/week @ 2024-05-05 39/week @ 2024-05-12 51/week @ 2024-05-19 39/week @ 2024-05-26 27/week @ 2024-06-02

167 downloads per month
Used in 18 crates (16 directly)

MIT/Apache

14KB
332 lines

pi_atom

全局的线程安全的原子字符串池,减少相同字符串的内存占用,也用于hashmap的键

如果全局该字符串最后一个引用被释放, 则该字符串会释放。

为了减少不停的创建和放入池的次数,高频单次的Atom,可以在应用层增加一个cache来缓冲Atom,定期检查引用计数来判断是否缓冲。

Dependencies

~2.4–8.5MB
~66K SLoC