All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Optimizing B+Tree Performance with Contiguous Memory Layouts

By

jasim

7mo ago· 10 min readenInsight

Summary

This technical article discusses optimizing B+Tree performance in database systems by using contiguous memory blocks for nodes instead of std::vector in C++. The approach improves CPU cache locality but increases implementation complexity. The article explores the trade-offs between performance gains and code maintainability when building high-performance database components.

Key quotes

· 5 pulled
For a high-performance B+Tree, the memory layout of each node must be a single contiguous block.
This improves locality of reference, increasing the likelihood that the node's contents reside in the CPU cache.
In C++, achieving this means forgoing the use of std::vector, as it introduces a layer of indirection through a separate memory allocation.
The solution to this problem though inevitably increases the implementation complexity and is mired with hidden drawbacks.
Nevertheless, this is still a necessary trade-off for unlocking high performance.
Snippet from the RSS feed
On database building blocks.

You might also wanna read

Performance Optimization: Replacing Protobuf with Direct C-to-Rust Bindings in PgDog PostgreSQL Proxy

The article details how PgDog, a PostgreSQL proxy written in Rust, replaced Protobuf serialization with direct C-to-Rust bindings to achieve

pgdog.dev·4mo ago

PostgreSQL Double Buffering: Why OS RAM and Buffer Cache Compete and How the 25% Rule Helps

This article explains the problem of double buffering in PostgreSQL, where the OS filesystem cache and PostgreSQL's shared_buffers both cach

hackernoon.com·4d ago

Optimizing Top K Query Performance in PostgreSQL: Challenges and Solutions

This technical article examines the challenges of optimizing Top K queries in PostgreSQL databases, where 'Top K' refers to retrieving the K

paradedb.com·2mo ago

Performance Optimization: How a 185-Microsecond Type Hint Boosted Throughput 13× in Clojure Roughtime Implementation

The article describes a performance optimization in a Clojure implementation of the Roughtime protocol, where a seemingly trivial change to

blog.sturdystatistics.com·3mo ago

Optimizing Geospatial SQL Queries with H3 Indexes for 400× Performance Gains

The article explains how to dramatically speed up geospatial SQL queries (geo joins) using H3 indexes. It describes the performance problems

floedb.ai·3mo ago

Advanced PostgreSQL Optimization Techniques Beyond Conventional Methods

This article presents unconventional optimization techniques for PostgreSQL databases, moving beyond standard approaches like query rewritin

hakibenita.com·4mo ago