Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Swapping Jolt's sorted collections to a B+tree

Jolt, a Clojure-inspired language, previously used a red-black tree to implement its sorted-map and sorted-set data structures. However, this tree had drawbacks, such as high memory usage and slower operations due to each entry requiring its own small node. The developer decided to explore if a different data structure could provide better performance.

After investigation, they found that a B+tree could be used, which led to swapping out the red-black tree for a persistent B+tree in Jolt's sorted collections. This change resulted in a 40% reduction in peak memory usage and faster operations across all sizes, as demonstrated in performance benchmarks. A B+tree keeps data in leaves with up to 16 entries and branches through inner nodes with up to 32 children, resulting in a tree that is much shallower than a red-black tree.

For example, a tree with 4 million entries in a red-black tree was only 5 levels deep in the B+tree. Additionally, B+trees have smaller metadata per entry, which reduces memory usage further. However, B+trees have a weakness in that building small ones can be slower than red-black trees. To mitigate this, the developer implemented tricks such as starting a fresh node when a node is full or dropping entries to half before merging.

These optimizations resulted in a scenario where the worst-case performance of the B+tree was only 1.05 times slower than the red-black tree, making it a viable alternative for large collections.

Rewritten by urgent.news; may contain errors — check the original.

Source: yogthos.net

Read the original at yogthos.net →

Report a problem with this story

More in Tech

Digital Natives: Vulnerable Targets in a Scam-Filled World - SmarterArticles S1E31

Written by Tim Green, narrated by AI. Listen to the full episode here . 🎙️ Season 1, Episode 31 | Duration: 20:11 JPMorganChase told students returning to campus this autumn that their lifelong…

  • JPMorgan warns college students about online fraud despite tech skills.
  • FBI data shows $500M+ lost to internet crimes by 20-29 year olds in 2025.
  • Overconfidence in spotting scams due to AI-generated phishing emails.

Rendering a Planet in the Browser: MapLibre, WebGL, and Keeping a Globe at 60 FPS

You can render a live planet in the browser at 60 frames per second — even with tens of thousands of points on it — if you treat the map as a WebGL scene with a strict 16.6 ms frame budget, not as a…

  • WorldEye renders live globe with 74,229 cameras using WebGL.
  • MapLibre GL JS enables GeoJSON data rendering in WebGL.
  • Clustering and queue system optimize performance for high frame rates.

More from Monday 23 November →