Giter Site home page Giter Site logo

newlinebench's Introduction

Count newlines really fast

Benchmark results on my machine (Core i5-4200M):

running 25 tests
test check ... ignored
test test_fast_newlines               ... bench:       2,175 ns/iter (+/- 620)
test test_fast_nonewlines             ... bench:       2,176 ns/iter (+/- 344)
test test_fast_random                 ... bench:      32,466 ns/iter (+/- 983)
test test_fast_somenewlines           ... bench:          16 ns/iter (+/- 2)
test test_faster_newlines             ... bench:       2,940 ns/iter (+/- 527)
test test_faster_nonewlines           ... bench:       2,938 ns/iter (+/- 956)
test test_faster_random               ... bench:      43,954 ns/iter (+/- 1,720)
test test_faster_somenewlines         ... bench:          25 ns/iter (+/- 5)
test test_fastest_newlines            ... bench:       1,286 ns/iter (+/- 167)
test test_fastest_nonewlines          ... bench:       1,284 ns/iter (+/- 383)
test test_fastest_random              ... bench:      19,039 ns/iter (+/- 5,534)
test test_fastest_somenewlines        ... bench:          14 ns/iter (+/- 3)
test test_hyperscreaming_newlines     ... bench:         716 ns/iter (+/- 90)
test test_hyperscreaming_nonewlines   ... bench:         712 ns/iter (+/- 239)
test test_hyperscreaming_random       ... bench:      10,901 ns/iter (+/- 492)
test test_hyperscreaming_somenewlines ... bench:          12 ns/iter (+/- 2)
test test_screaming_newlines          ... bench:       1,180 ns/iter (+/- 258)
test test_screaming_nonewlines        ... bench:       1,180 ns/iter (+/- 140)
test test_screaming_random            ... bench:      17,565 ns/iter (+/- 740)
test test_screaming_somenewlines      ... bench:          10 ns/iter (+/- 3)
test test_slow_newlines               ... bench:       5,698 ns/iter (+/- 814)
test test_slow_nonewlines             ... bench:       3,704 ns/iter (+/- 797)
test test_slow_random                 ... bench:      67,856 ns/iter (+/- 2,345)
test test_slow_somenewlines           ... bench:          31 ns/iter (+/- 2)

I should note that this machine does have POPCNT, though it does not appear to make any difference.

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.