Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid repeated String#slice calls in stringDistance #1095

Merged
merged 1 commit into from Dec 2, 2017

Commits on Nov 29, 2017

  1. Avoid repeated String#slice calls in stringDistance.

    The `stringDistance` function calls
    
    ```js
    strA.slice(0, -1)
    ```
    
    and
    
    ```js
    strB.slice(0, -1)
    ```
    
    multiple times, which is a bit of a waste of time here. JavaScript
    engines cannot generally eliminate the duplicated calls easily, so
    it's better to avoid the redundant calls altogether.
    
    This improves the chai test on the
    [web-tooling-benchmark](https://github.com/v8/web-tooling-benchmark) by
    around 8% when run with upcoming V8 6.4.
    bmeurer committed Nov 29, 2017
    Copy the full SHA
    b0b7b05 View commit details
    Browse the repository at this point in the history