Topic

Algorithms

Algorithm and data structure discussions covering complexity analysis, competitive programming, and practical implementation insights from developer communities.

What this topic tracks

  • Engineering practices and ecosystem debates
  • Tools, architecture, and implementation lessons
  • Relevant discussions from developer communities

Algorithms · 306 stories

Recent stories

Each story's summary, with the places it was discussed.

Summaries are written by AI from the linked sources. Open the source for full context.

20 stories

A Better SQL in 11 Lines of Code

prela-lang.org · 31 Aug

Algorithms · Database · Programming Languages

A UCLA RePL tutorial explains Prela, a query language built entirely around binary relations.

Using a toy Python implementation, it demonstrates relation composition, automatic foreign-key resolution, joins, filtering with predicates, conjunction, and projection. These operators compose into concise queries that can replace lengthy SQL, while also supporting grouping and aggregation.

Rust zero-cost abstractions vs. SIMD

turbopuffer.com · 3 Mar

Algorithms · Low-Level Programming · Performance

turbopuffer reduced full-text search latency from 220ms to 47ms by optimizing Rust's "zero-cost" iterators.

They discovered that recursive iterator calls prevented CPU vectorization and SIMD optimizations. By implementing batched iterators—a classic database technique—they amortized merge overhead and enabled the compiler to generate highly efficient vectorized code for large-scale document filtering.

An Introduction to Bε-trees and Write-Optimization

usenix.org · 2 Nov

Algorithms · Database · NoSQL · Performance · Computer Science

Bε-tree is a write-optimized data structure for organizing on-disk storage in databases and file systems.

It offers a key-value API like B-tree, with improved performance especially for inserts, range queries, and key-value updates. The article explains how Bε-tree works, compares its asymptotic performance with B-tree and Log-Structured Merge trees (LSM-trees), reports real-world measurements, and outlines how applications can maximize its performance.

rat's minimal register allocator

hexrat.cc · 7 Oct

Algorithms · Low-Level Programming · Performance · Programming Languages

rat replaced its 1,392-line linear scan register allocator with a 584-line priority bin-packing allocator that assigns live ranges by priority, using coalescing, holes, spill weights, and physical-register hints.

It performs no eviction, splitting, or second allocation pass, yet produces better code: 3.6% fewer instructions and 22% fewer stores. On sqlite at -O0, allocator time fell 77% and total compile time 43%, showing that simpler heuristics retained most benefits.

Unicode 18.0.0

unicode.org · 16 Sept

Algorithms · Database · Computer Science

Unicode 18.0, announced as a preliminary September 2026 release, adds 13,007 characters, reaching 172,808, including Proto-Cuneiform numerals, Jurchen, and Seal scripts.

It updates the Unicode Character Database, code charts, conformance rules, segmentation, collation, security, emoji, and linkification standards. Developers should review migration guidance for changed properties, algorithms, variation sequences, and CJK data.

Lindenmayer Systems

justinpombrio.net · 16 Feb

Algorithms · Rust · Computer Science

Exploring Lindenmayer systems (L-Systems), this content demonstrates how recursive string replacement rules combined with Logo-style turtle graphics create complex fractal patterns like the dragon curve, Koch snowflake, and space-filling curves.

Implemented as a Rust library, it showcases various mathematical visualizations and provides source code for generating these intricate geometric images.

Pratt parsing is a black box

vinipsmaker.github.io · 1 Nov

Algorithms · Programming Languages · Education

Pratt parsing is a code-organization mindset, not merely a precedence-climbing algorithm.

It assigns semantic actions to terminals: nuds handle tokens with nothing left, leds handle tokens with a left expression, and binding powers control precedence and associativity. This avoids backtracking and left recursion while enabling composable subparsers, macros, and context-sensitive parsing. Pratt still needs a separate, often modal lexer and cannot parse statements or incremental syntax alone. The recommended practice is to treat the algorithm as a black box.

Perspec 1.0: A Haskell desktop app for perspective correction of document photos

adriansieber.com · 24 Aug

Algorithms · Computer Vision · C

Perspec 1.0 is a cross-platform desktop and CLI app for correcting image perspective, especially in document and receipt photos.

Its new computer vision pipeline segments document boundaries and uses Förstner corner detection rather than assuming straight edges, while shadow-removing preprocessing and Otsu's Method produce compact, clean black-and-white exports. Windows, macOS, Linux, batch processing, manual correction, and Save BW Smooth complete the release.

Curl Performance

daniel.haxx.se · 14 Aug

Algorithms · Performance · Testing

curl has launched a public, automated performance-testing system that builds the latest git commit every 20 minutes on a local machine, runs 24 tests, and publishes logs and gnuplot graphs.

The system tracks variation, thresholds (“stakes”), distributions, and trends to detect regressions, while acknowledging hardware and environment limitations. It is an incremental foundation for performance optimization.

5× faster fast_blur in image-rs

apas.tel · 15 May

Algorithms · Performance · Rust

The image-rs library's fast_blur algorithm was optimized to be 5.9x faster by replacing expensive floating-point arithmetic with integer operations and eliminating division instructions.

Using a trait-based design, the implementation now selects integer paths at compile time for 8-bit images, achieving performance suitable for real-time applications without sacrificing output quality.

HTTP RateLimit headers

dotat.at · 13 Jan

Algorithms · REST API · Software Architecture

The IETF is currently developing a draft to standardize RateLimit header fields for HTTP, enabling servers to inform clients about remaining quotas and reset times to prevent 429 Too Many Requests errors.

While the draft primarily assumes traditional quota-reset algorithms that can cause burst-pause cycles, this article explores how to integrate linear rate limit algorithms like Generic Cell Rate Algorithm (GCRA). By rephrasing headers in terms of client behavior rather than server-side resets, servers can encourage smoother request patterns. The author demonstrates a method using a 'not-before' timestamp state to calculate effective windows and available quotas dynamically. This approach effectively shrinks windows for busy clients, reducing burstiness and promoting a more stable traffic flow compared to static window or log-based algorithms.

Erasing Existentials

wolfgirl.dev · 20 May

Algorithms · Programming Languages · Rust

This article explores how to handle existential quantification in Rust when dealing with traits that have multiple generic parameters.

It compares 'dyn Trait' and 'impl Trait', examines the 'for-exists' identity, and demonstrates strategies like associated types, PhantomData, and manual type erasure using 'std::any::Any' to achieve desired abstraction levels.

Seeing types where others don't

theconsensus.dev · 18 Mar

Artificial Intelligence · Algorithms · Programming Languages

The author documents their multi-year effort to implement static type checking in jq.

By inferring types through shape analysis and constraint solving, they aim to replace cryptic runtime errors with informative, context-aware diagnostics. This approach highlights the potential for advanced type inference to enhance developer experience in dynamically typed languages without requiring manual type annotations.

11 nanoseconds per word: Ridiculously Over-Optimizing Anagrams

wiredream.com · 5 Nov

Algorithms · Performance · Rust

A Rust anagram index was optimized from 31 ms to 1.96 ms for 178,690 Scrabble dictionary words, reducing cost from 173 to 10.9 ns per word, a 15.8× speedup.

The progression replaced sorted-string keys and allocations with flat arrays, packed u128 letter counts, FxHashMap, corpus-tuned 64-bit Gödel numbering using collision-free prime products, packed word representations, dual accumulators, and a branchless auto-vectorized loop. The index will support a complete word-ladder solver.

Refinement E-Graphs

philipzucker.com · 4 Oct

Algorithms · Programming Languages · Computer Science

Refinement e-graphs extend e-graphs with a native, transitive and reflexive `<=` relation alongside equality, targeting compiler rewrites that refine underspecified programs into executable ones.

A prototype based on Max Willsey’s microegg supports inequality union-find, variance-aware refinement closure, e-matching, and extraction. Its “don’t care” circuit example models terms as sets of Boolean results, allowing independent choices at each use. The approach is simple but less efficient and potentially incomplete than equality-based processing.

Finding Bugs

matklad.github.io · 30 Sept

Algorithms · Programming Languages · Testing

This case study shows how a lightweight generative-testing harness found two historical bugs in Rust’s regex crate by cross-checking regex against regex_lite as an oracle.

Effective fuzzing favors small, tricky inputs, randomized feature distributions, memory reuse, and many iterations. The broader lesson: build accessible oracles and improve fuzzers when escaped bugs expose testing gaps.

Implementing FMA and finding bugs in C and Rust standard libraries

shnatsel.github.io · 2 Sept

Algorithms · Low-Level Programming · Performance

An investigation found rare subnormal-value rounding bugs in Rust’s f32 FMA fallbacks and musl libc’s fmaf(), affecting systems without hardware FMA, especially older Intel and 32-bit ARM.

A formally verified SIMD emulation algorithm was corrected, exposing related Rust, musl, and compiler issues. fearless_simd is fixed; upstream patches and reviews remain ongoing, with possible simulation-accuracy consequences.

An interactive introduction to the spanning tree protocol

vincent.bernat.ch · 24 Aug

Algorithms · Testing · Open Source

An interactive guide explains how RSTP prevents Ethernet loops by electing a root bridge, assigning port roles, transitioning states, and propagating topology changes.

Browser simulations run the open-source MSTPD implementation compiled to WebAssembly, illustrating convergence, edge-port security, MSTP, scalability limits, failure recovery, and datacenter out-of-band use cases.

Compile-Time Improvements in LLVM 23

aengelke.net · 21 Aug

Algorithms · Low-Level Programming · Performance

LLVM 23 reduces -O3 compile time by 6.75% (10.53% for sqlite3) through faster hash tables, SmallVector, dominator trees, successor/predecessor iteration, metadata handling, block numbering, and other IR changes.

GlobalISel improvements narrow its AArch64 -O0 gap with FastISel. Startup costs for shared libraries were reduced, while precompiled headers cut LLVM/Clang build times by about 45%.

Use “\A...\z”, not “^...$” with Python regular expressions

sethmlarson.dev · 27 Jan

Algorithms · Programming Languages · Python

For years, the Python re module handled the '$' anchor in a way that could lead to unexpected behavior, specifically matching both the end of a string and a trailing newline.

This follow-up article highlights a significant improvement in the upcoming Python 3.14 release, which introduces support for the '\z' anchor. Unlike '$', '\z' exclusively matches the absolute end of the string, ensuring more predictable behavior for developers. While other languages like Golang and Rust have long supported '\z', Python and ECMAScript were notable outliers. The author notes that while '\Z' serves as a temporary alternative in current Python versions, its inconsistent behavior across other languages like PHP or Java makes the standardization of '\z' in Python a major win for cross-language regular expression consistency and security best practices.

Where it came fromLobstersCreate a Snapbyte.dev digest and choose Algorithms as one of your topics.Build your digest