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

util: refactor format method. #12407

Closed
wants to merge 8 commits into from
Closed

Commits on Apr 14, 2017

  1. util: refactor format method.Performance improved.

    Method format refactored to make it more maintenable, replacing the
    switch by a function factory, that returns the appropiated function
    given the character (d, i , f, j, s).
    
    Also, performance when formatting an string that contains several
    consecutive % symbols is improved. The test:
    `const numSamples = 10000000;
    const strPercents = '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%s%%%%%%%%%%%%%%%%%i%%%%%%%%%%%%%%%%%%%%%%%%%%';
    var s;
    console.time('Percents');
    for (let i = 0; i < numSamples; i++) {
      s = util.format(strPercents, 'test', 12);
    }
    console.timeEnd('Percents');`
    
    Original time:   28399.708ms
    After refactor:  23763.788ms
    Improved: 16%
    jesus-seijas-sp committed Apr 14, 2017
    Configuration menu
    Copy the full SHA
    2d11e81 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    181ec8a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    aa30bb2 View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2017

  1. util: refactor format method.

    Improved performance
    jesus-seijas-sp committed Apr 15, 2017
    Configuration menu
    Copy the full SHA
    bf6f8fe View commit details
    Browse the repository at this point in the history
  2. util: refactor format method.

    Fix lint error: Infix operators must be spaced
    jesus-seijas-sp committed Apr 15, 2017
    Configuration menu
    Copy the full SHA
    9d032c2 View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2017

  1. util: refactor format method

    Improving performance.
    jesus-seijas-sp committed Apr 16, 2017
    Configuration menu
    Copy the full SHA
    da7a15e View commit details
    Browse the repository at this point in the history
  2. Fix lint

    jesus-seijas-sp committed Apr 16, 2017
    Configuration menu
    Copy the full SHA
    78118c7 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2017

  1. util: refactor format method

    - Correct whitespace
    - Static parts of if before unstatic.
    jesus-seijas-sp authored May 31, 2017
    Configuration menu
    Copy the full SHA
    9f762cf View commit details
    Browse the repository at this point in the history