Git Product home page Git Product logo

1brc's Introduction

Optimizing C++ code to run 87x faster: The One Billion Row Challenge

This is a companion repository for the Daily bit(e) of C++ #474: Optimizing code to run 87x faster.

Generating input

If you want to generate input for the 1brc challenge please follow the documentation at gunnarmorling/1brc.

The gunnarmorling/1brc repository is part of this repository as a submodule.

git submodule init
pushd 1brc
./create_measurements.sh 1000000000
./calculate_average_baseline.sh >golden_output.txt
popd
mv 1brc/measurements.txt .
mv 1brc/golden_output.txt .

If you want to also test against a random input, you can use the create_measurements3.sh instead.

1brc's People

Contributors

happycerberus avatar

Stargazers

Zane Chiang avatar Vladislav Antonov avatar Carlos Pavanetti avatar ctracerpp avatar https://github.com/settings/admin avatar junw avatar  avatar Alexander avatar zhang zhiguo avatar  avatar qzhao19 avatar wxing avatar sund123 avatar ys_cv avatar  avatar zhongyuankai avatar  avatar  avatar Lupnis J H avatar svz avatar  avatar LiYang avatar Zz avatar ValK avatar  avatar  avatar Bård Sigurd Møller avatar is avatar Matthew avatar  avatar Cuda Chen avatar Romain Laneuville avatar Armando Liebenberg avatar Tadej Svetina avatar Bob Wilmes avatar Matthieu Poullet avatar Thomas Milox avatar  avatar Adrià Arrufat avatar Xiyao Xin avatar JH avatar  avatar Addy avatar Tarun avatar

Watchers

 avatar  avatar

1brc's Issues

Proposal: hash function optimization

I measuresd 0 (zero) collisions with this function.

Measurement parse(std::span<const char>::iterator &iter) {
    Measurement result;

    const char *begin = iter.base();
    uint32_t h = 0;
    while (*iter != ';') {
        h = (h << 6) + (h << 16) - h + *iter; // SDBM_hash
        ++iter;
    }
    result.hash = (uint16_t)((h >> 16) ^ h);
    result.name = {begin, iter.base()};
    ++iter;

    result.value = parse_int_table(iter);

    return result;
}

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.