Get the latest tech news

Fast B-Trees


(This is part of a series on the design of a language. See the list of posts here.) Many 'scripting' languages use a hashmap for their default associative data-structure (javascript objects, python dicts, etc).

Repeatedly growing large allocations without fragmentation is difficult on wasm targets, because virtual memory tricks are not available and pages can't be unmapped. And while btrees avoid many of the performance edge cases of hashmaps, they also have some cliffs of their own to fall off as comparisons get more expensive and touch more memory, as we saw with the random-ish strings above. I'd need to add some extra tweaks to allow the btree root node to start small and grow, rather than paying the full 512 bytes for a map with only 1 key.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of trees

trees

Related news:

News photo

"Frost crack" sounds may come from sky, not trees

News photo

Adept Materials’ dehumidifying paint was inspired by trees and semiconductors

News photo

Climate Change Has Fried Earth So Badly Trees Won’t Save You Today—But I Will