Git Product home page Git Product logo

1brc-rust's Introduction

1BRC Rust

This is my nice and safe rust implementation of the java 1brc

After all of my changes I think that the biggest way to speed this up is using a custom made hashmap, a linear probe with a very simple hash like FNV, pluse computing the hash as we iterate over the text instead of calling the hashmap entry function.

runner specs:
  • 3.6 GHz with 16 cores
  • 16 GB of ram
  • slow AF hard drive ( but the test was done with a hot page without it we need like 5 min to read the file of the disk )

Base line result

real 2m35.141s user 0m0.000s sys 0m0.015s

My first try (memory mapped file)

real 1m7.125s user 0m0.000s sys 0m0.000s

Second try (unsafe utf8 read + compile time flags)

real 0m40.704s user 0m0.000s sys 0m0.000s

Third try (rolling my own basic parser)

real 0m36.119s user 0m0.000s sys 0m0.000s

branchless parser not sure if faster but w/e

real 0m35.752s user 0m0.000s sys 0m0.000s

better branchless parser

real 0m34.433s user 0m0.000s sys 0m0.000s

removed some bounds check

real 0m33.155s user 0m0.000s sys 0m0.000s

added basic multi-threading

real 0m4.718s user 0m0.000s sys 0m0.000s

reserve memory in hashmap

real 0m4.531s user 0m0.000s sys 0m0.000s

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.