TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 230 subscribers
Post #25013 15
SIMD IPv6 lookup vs Patricia trie: surprising real-world results

I’ve been working on a C++ implementation of a SIMD-accelerated IPv6 longest-prefix-match (LPM) structure based on the PlanB paper (linearized B+-tree + AVX-512).



On synthetic workloads, the results were as expected:

\~20× faster than a naive Patricia trie.



But when I switched to a real BGP table (RIPE RIS rrc00, \~254K IPv6 prefixes), I got a surprising result:



A simple Patricia trie can actually match or even outperform the SIMD-based tree.



Numbers (single core, Ice Lake laptop):

\- SIMD tree: \~65–137 MLPS

\- Patricia: \~95 MLPS median



The reason seems to be cache locality and early exits:

\- Patricia often resolves lookups after just a few pointer hops in hot regions of the address space

\- The SIMD tree always pays a fixed traversal cost (depth \~7)



So even though the SIMD approach is more “theoretically efficient”, real-world prefix distribution and access patterns change the outcome quite a bit.



I’m curious if others have observed similar effects in routing / packet processing systems, or when comparing structures like PopTrie / CP-Trie.



Repo (MIT, includes benchmarks + real BGP reproduction):

https://github.com/esutcu/planb-lpm

https://redd.it/1sqe08e
@r_cpp
GitHub GitHub - esutcu/planb-lpm Contribute to esutcu/planb-lpm development by creating an account on GitHub.
More from @r_cpp
  1. Oct 6, 2026operator<>: A Dream of Higher-order Metaprogramming Parity https://www.elbeno.com/blog/?p=…
  2. Oct 6, 2026University of Waterloo user study on understanding CMake changes Hi everyone, I’m Mattie N…
  3. Oct 6, 2026Try to Implement Reflection Annotations in C++20 https://typecombinator.github.io/en/posts…
  4. Oct 5, 2026New C++ Conference Videos Released This Month - September 2026 (Updated To Include Videos…
  5. Oct 5, 2026What’s New for C++ Developers in Visual Studio 2026 (18.7 – 18.10) https://devblogs.micros…
  6. Oct 5, 2026Notes on dllexport and dllimport https://www.hanshq.net/dllexport.html https://redd.it/1wy…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →