GithubHelp home page GithubHelp logo

levenshtein's Introduction

levenshtein

Making rust as fast as it can go

Improving the performance of the Rust code in Christian's article

  • Baseline: 2.077593106
  • 6ff99a5: &str.chars().count() -> &str.len(): 2.022744823
  • 1dede2f: reuse same vector: 1.880497681
  • 6adaf13: build cache without .collect(): 1.7518643919999999

And breaking some of Christian's rules:

  • 92d0b82: remove vector bounds checks: 1.475065986
  • 23a7604: pre-allocate vector 100 chars: 1.455840814
  • 7f47ea9: add notes of some interesting findings
  • 73bdea8: use Wrapping to avoid int overflow checks (no real difference)
  • 03f9200: eliminate branches (no real difference)

Interesting findings:

  • Vector bounds checks are surprisingly expensive
  • Rust's opt-in performance improvements look rather ugly :(
  • std::cmp::min has poor performance compared to a hand written function (which was included in the Baseline). This is rather curious and concerning.

levenshtein's People

Contributors

anderj017 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.