Leminal Space
  • Communities
  • Create Post
  • Create Community
  • Aquileo | heart
    Support Lemmy
  • Aquileo | search
    Search
  • Login
  • Sign Up
cm0002@suppo.fi to Programming@programming.dev · 17 days ago

Static search trees: 40x faster than binary search

curiouscoding.nl

Aquileo | external-link
Aquileo | message-square
0
Aquileo | link
Aquileo | fedilink
  • cross-posted to:
  • [email protected]
  • [email protected]
28
Aquileo | external-link

Static search trees: 40x faster than binary search

curiouscoding.nl

cm0002@suppo.fi to Programming@programming.dev · 17 days ago
Aquileo | message-square
0
Aquileo | link
Aquileo | fedilink
  • cross-posted to:
  • [email protected]
  • [email protected]
Table of Contents 1 Introduction 1.1 Problem statement 1.2 Motivation 1.3 Recommended reading 1.4 Binary search and Eytzinger layout 1.5 Hugepages 1.6 A note on benchmarking 1.7 Cache lines 1.8 S-trees and B-trees 2 Optimizing find 2.1 Linear 2.2 Auto-vectorization 2.3 Trailing zeros 2.4 Popcount 2.5 Manual SIMD 3 Optimizing the search 3.1 Batching 3.2 Prefetching 3.3 Pointer arithmetic 3.3.1 Up-front splat 3.3.2 Byte-based pointers 3.3.3 The final version 3.4 Skip prefetch 3.5 Interleave 4 Optimizing the tree layout 4.1 Left-tree 4.2 Memory layouts 4.3 Node size \(B=15\) 4.3.1 Data structure size 4.4 Summary 5 Prefix partitioning 5.1 Full layout 5.2 Compact subtrees 5.3 The best of both: compact first level 5.4 Overlapping trees 5.5 Human data 5.6 Prefix map 5.7 Summary 6 Multi-threaded comparison 7 Conclusion 7.1 Future work 7.1.1 Branchy search 7.1.2 Interpolation search 7.1.3 Packing data smaller 7.1.4 Returning indices in original data 7.1.5 Range queries 7.1.6 Sorting queries 7.1.7 Suffix array searching In this post, we will implement a static search tree (S+ tree) for high-throughput searching of sorted data, as introduced on Algorithmica. We’ll mostly take the code presented there as a starting point, and optimize it to its limits. For a large part, I’m simply taking the ‘future work’ ideas of that post and implementing them. And then there will be a bunch of looking at assembly code to shave off all the instructions we can. Lastly, there will be one big addition to optimize throughput: batching.
Aquileo | alert-triangle
You must log in or # to comment.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



Visibility: Public
Aquileo | globe

This community can be federated to other instances and be posted/commented in by their users.

  • 297 users / day
  • 1.15K users / week
  • 3.23K users / month
  • 8.58K users / 6 months
  • 51 local subscribers
  • 27.9K subscribers
  • 3.45K Posts
  • 48.7K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • UlrikHD@programming.dev
  • bugsmith@programming.dev
  • Spyro@programming.dev
  • UI: 0.19.19
  • BE: 0.19.19-jemalloc
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org