GithubHelp home page GithubHelp logo

search-perf's Introduction

Performance Benchmarking for sorted search

The goal of this project is to measure the performance of searching for an item within a static set. The factors being compared are the data layout and branchless vs branching code.

Measured Structures / Algorithms

There are 2 data structures I am measuring performance of, a sorted set and a sorted map. For each data structure I am implementing 4 versions:

  • backed by sorted array and binary search
  • backed by sorted array and branchless binary search
  • backed by eytzinger layout
  • backed by eytzinger layout and a branchless search

In addition for the Map, I am comparing performance when the <Key, Value> is stored together versus in separate sections.

Benchmarking strategy

I will benchmark the structures with varying sizes, to account for performance when memory does and doesnt fit in cache lines. The sizes I plan are:

  • powers of 2 from 2^1 to 2^24
  • multiples of 1000, from 1000 to 100,000

(i am including the powers of 2 due to potential issues with cache coherence)

Tools

  • perf: record cpu cycles and cache misses

Setup

  1. generate n random integers
  2. populate all structures
  3. generate 1 million queries

Runs

  1. start with a dry run, not measured in benchmarks
  2. start timer
  3. run the 1 million queries
  4. end timer

Interpretation

I will be looking

Results

WIP.

Inspiration

I recently came across Algorithms for Modern Hardware by Sergey Slotin. I found it to be a great read! He does a great job of gathering lots of useful information in one place. This inspired me to give performance benchmarking in cpp a try, specifically for the eytzinger layout and branch predication.

I have also came across multiple blogs on data oriented design, and wanted to test the performance impact on a structure like a map.

search-perf's People

Contributors

zyx-db avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.