Get the latest tech news

Small Strings in Rust: smolstr vs. smartstring (2020)


Hey everyone! This article is brought to you by a shameless nerd snipe , courtesy of Pascal. In case you've blocked Twitter for your own good, this reads: There should be ...

We can also see that between those peaks, memory usage increases steadily - each String stores its data on the heap, which explains the number of allocation events, 2017. And our initial streaming solution may well work - because we're only reading out the city and state fields - not all the others, which I'm sure make up the bulk of the 100 GiB input file. As for smartstring, it's recommended for "a key type for a B-tree" (such as BTreeMap), because inline strings greatly improve cache locality.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Rust

Rust

Photo of smolstr

smolstr

Photo of Small Strings

Small Strings

Related news:

News photo

Mimalloc Cigarette: Losing one week of my life catching a memory leak (Rust)

News photo

The weird of function-local types in Rust

News photo

I spent 2 years building my own game engine (Rust, WASM, WebGPU)