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

Avoid calling replace in normalizeSlashes when it would do nothing #44100

Merged
merged 2 commits into from
May 21, 2021

Conversation

amcasey
Copy link
Member

@amcasey amcasey commented May 14, 2021

On Windows, there will probably be a negligible slowdown, iterating over the pre-slash prefix of each unnormalized path (though we might come out ahead if paths are normalized more than once).

On *nix, this saves work - 1.8s -> 0.4s in the project I'm investigating.

On Windows, there will probably be a negligible slowdown, iterating over
the pre-slash prefix of each unnormalized path (though we might come out
ahead if paths are normalized more than once).

On *nix, this saves work - 1.8s -> 0.4s in the project I'm
investigating.
@amcasey amcasey requested a review from rbuckton May 14, 2021 21:59
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels May 14, 2021
@amcasey
Copy link
Member Author

amcasey commented May 14, 2021

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 14, 2021

Heya @amcasey, I've started to run the perf test suite on this PR at 0c797a5. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

@amcasey
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..44100

Metric master 44100 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 345,047k (± 0.01%) 345,001k (± 0.02%) -47k (- 0.01%) 344,781k 345,127k
Parse Time 1.90s (± 0.72%) 1.91s (± 0.46%) +0.01s (+ 0.42%) 1.89s 1.93s
Bind Time 0.84s (± 0.80%) 0.84s (± 0.88%) +0.00s (+ 0.36%) 0.83s 0.86s
Check Time 5.25s (± 0.68%) 5.27s (± 0.48%) +0.02s (+ 0.32%) 5.21s 5.31s
Emit Time 5.57s (± 0.59%) 5.63s (± 1.21%) +0.05s (+ 0.97%) 5.52s 5.86s
Total Time 13.57s (± 0.41%) 13.65s (± 0.60%) +0.08s (+ 0.60%) 13.49s 13.89s
Compiler-Unions - node (v10.16.3, x64)
Memory used 200,388k (± 0.03%) 200,382k (± 0.04%) -6k (- 0.00%) 200,190k 200,601k
Parse Time 0.78s (± 0.46%) 0.79s (± 1.04%) +0.00s (+ 0.38%) 0.77s 0.81s
Bind Time 0.53s (± 1.29%) 0.53s (± 1.13%) +0.00s (+ 0.00%) 0.51s 0.54s
Check Time 7.53s (± 0.48%) 7.57s (± 0.42%) +0.04s (+ 0.50%) 7.48s 7.63s
Emit Time 2.45s (± 0.93%) 2.43s (± 1.08%) -0.02s (- 0.81%) 2.39s 2.51s
Total Time 11.29s (± 0.38%) 11.31s (± 0.43%) +0.02s (+ 0.19%) 11.19s 11.40s
Monaco - node (v10.16.3, x64)
Memory used 341,667k (± 0.02%) 341,710k (± 0.02%) +43k (+ 0.01%) 341,604k 341,867k
Parse Time 1.55s (± 0.60%) 1.55s (± 0.50%) -0.00s (- 0.19%) 1.53s 1.56s
Bind Time 0.74s (± 0.75%) 0.75s (± 1.02%) +0.00s (+ 0.40%) 0.73s 0.76s
Check Time 5.39s (± 0.70%) 5.41s (± 0.66%) +0.02s (+ 0.30%) 5.32s 5.49s
Emit Time 2.97s (± 0.70%) 2.96s (± 0.93%) -0.01s (- 0.20%) 2.91s 3.05s
Total Time 10.65s (± 0.53%) 10.66s (± 0.46%) +0.01s (+ 0.08%) 10.56s 10.80s
TFS - node (v10.16.3, x64)
Memory used 304,248k (± 0.02%) 304,410k (± 0.10%) +162k (+ 0.05%) 304,084k 305,571k
Parse Time 1.21s (± 0.46%) 1.22s (± 0.90%) +0.01s (+ 0.83%) 1.20s 1.24s
Bind Time 0.71s (± 0.67%) 0.70s (± 0.95%) -0.00s (- 0.57%) 0.69s 0.72s
Check Time 4.84s (± 0.47%) 4.86s (± 0.46%) +0.02s (+ 0.45%) 4.80s 4.90s
Emit Time 3.14s (± 1.19%) 3.12s (± 1.05%) -0.02s (- 0.70%) 3.06s 3.18s
Total Time 9.90s (± 0.45%) 9.90s (± 0.56%) +0.01s (+ 0.08%) 9.76s 9.99s
material-ui - node (v10.16.3, x64)
Memory used 474,028k (± 0.01%) 474,077k (± 0.01%) +49k (+ 0.01%) 473,999k 474,180k
Parse Time 1.94s (± 0.89%) 1.94s (± 0.57%) -0.00s (- 0.10%) 1.91s 1.96s
Bind Time 0.66s (± 0.76%) 0.65s (± 0.68%) -0.00s (- 0.46%) 0.64s 0.66s
Check Time 14.24s (± 0.35%) 14.30s (± 0.65%) +0.06s (+ 0.43%) 14.13s 14.50s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.84s (± 0.32%) 16.90s (± 0.58%) +0.06s (+ 0.35%) 16.71s 17.12s
Angular - node (v12.1.0, x64)
Memory used 322,607k (± 0.02%) 322,591k (± 0.02%) -16k (- 0.01%) 322,509k 322,770k
Parse Time 1.90s (± 0.63%) 1.90s (± 0.72%) +0.00s (+ 0.05%) 1.88s 1.93s
Bind Time 0.82s (± 0.71%) 0.83s (± 1.11%) +0.01s (+ 1.84%) 0.81s 0.85s
Check Time 5.15s (± 0.32%) 5.17s (± 0.38%) +0.02s (+ 0.33%) 5.13s 5.22s
Emit Time 5.78s (± 0.80%) 5.80s (± 0.82%) +0.02s (+ 0.28%) 5.73s 5.97s
Total Time 13.66s (± 0.48%) 13.71s (± 0.44%) +0.05s (+ 0.34%) 13.62s 13.90s
Compiler-Unions - node (v12.1.0, x64)
Memory used 187,549k (± 0.16%) 187,354k (± 0.14%) -195k (- 0.10%) 186,773k 187,920k
Parse Time 0.77s (± 0.78%) 0.77s (± 0.68%) +0.00s (+ 0.39%) 0.76s 0.78s
Bind Time 0.53s (± 1.32%) 0.53s (± 1.40%) +0.00s (+ 0.38%) 0.52s 0.56s
Check Time 7.04s (± 0.64%) 7.04s (± 0.68%) +0.01s (+ 0.10%) 6.92s 7.15s
Emit Time 2.43s (± 1.68%) 2.46s (± 2.01%) +0.02s (+ 0.86%) 2.36s 2.56s
Total Time 10.77s (± 0.65%) 10.80s (± 0.73%) +0.03s (+ 0.31%) 10.65s 10.98s
Monaco - node (v12.1.0, x64)
Memory used 323,988k (± 0.05%) 324,113k (± 0.03%) +125k (+ 0.04%) 323,996k 324,402k
Parse Time 1.54s (± 0.66%) 1.55s (± 0.65%) +0.01s (+ 0.72%) 1.52s 1.56s
Bind Time 0.72s (± 0.83%) 0.72s (± 0.93%) +0.00s (+ 0.14%) 0.71s 0.73s
Check Time 5.21s (± 0.36%) 5.23s (± 0.52%) +0.01s (+ 0.29%) 5.17s 5.27s
Emit Time 3.04s (± 1.05%) 3.03s (± 1.23%) -0.00s (- 0.10%) 2.99s 3.14s
Total Time 10.50s (± 0.38%) 10.53s (± 0.55%) +0.03s (+ 0.26%) 10.42s 10.68s
TFS - node (v12.1.0, x64)
Memory used 288,704k (± 0.02%) 288,760k (± 0.02%) +56k (+ 0.02%) 288,678k 288,901k
Parse Time 1.21s (± 0.62%) 1.22s (± 0.72%) +0.01s (+ 0.83%) 1.20s 1.23s
Bind Time 0.70s (± 0.99%) 0.70s (± 0.53%) 0.00s ( 0.00%) 0.69s 0.70s
Check Time 4.76s (± 0.29%) 4.79s (± 0.52%) +0.03s (+ 0.69%) 4.74s 4.83s
Emit Time 3.13s (± 0.77%) 3.15s (± 1.30%) +0.03s (+ 0.93%) 3.06s 3.25s
Total Time 9.78s (± 0.32%) 9.86s (± 0.45%) +0.07s (+ 0.77%) 9.79s 9.99s
material-ui - node (v12.1.0, x64)
Memory used 451,959k (± 0.01%) 451,920k (± 0.01%) -39k (- 0.01%) 451,795k 452,067k
Parse Time 1.95s (± 0.56%) 1.94s (± 0.40%) -0.01s (- 0.56%) 1.92s 1.95s
Bind Time 0.64s (± 0.87%) 0.64s (± 0.74%) +0.01s (+ 0.78%) 0.63s 0.65s
Check Time 12.81s (± 0.48%) 12.82s (± 0.49%) +0.01s (+ 0.06%) 12.66s 12.98s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.40s (± 0.40%) 15.40s (± 0.41%) +0.00s (+ 0.00%) 15.25s 15.56s
Angular - node (v14.15.1, x64)
Memory used 321,295k (± 0.00%) 321,288k (± 0.00%) -7k (- 0.00%) 321,260k 321,321k
Parse Time 1.91s (± 0.70%) 1.91s (± 0.43%) -0.01s (- 0.26%) 1.89s 1.92s
Bind Time 0.87s (± 0.34%) 0.88s (± 0.57%) +0.01s (+ 0.81%) 0.86s 0.88s
Check Time 5.17s (± 0.41%) 5.20s (± 0.53%) +0.02s (+ 0.46%) 5.13s 5.24s
Emit Time 5.81s (± 0.36%) 5.84s (± 0.43%) +0.03s (+ 0.52%) 5.81s 5.91s
Total Time 13.76s (± 0.32%) 13.82s (± 0.32%) +0.06s (+ 0.41%) 13.74s 13.95s
Compiler-Unions - node (v14.15.1, x64)
Memory used 188,755k (± 0.58%) 188,430k (± 0.61%) -324k (- 0.17%) 186,482k 189,745k
Parse Time 0.80s (± 0.50%) 0.80s (± 0.85%) +0.01s (+ 0.75%) 0.79s 0.82s
Bind Time 0.55s (± 0.62%) 0.56s (± 0.61%) +0.00s (+ 0.72%) 0.55s 0.56s
Check Time 7.14s (± 0.47%) 7.13s (± 0.69%) -0.01s (- 0.11%) 7.05s 7.24s
Emit Time 2.44s (± 0.91%) 2.42s (± 0.82%) -0.02s (- 0.66%) 2.39s 2.47s
Total Time 10.93s (± 0.38%) 10.92s (± 0.45%) -0.01s (- 0.09%) 10.82s 11.03s
Monaco - node (v14.15.1, x64)
Memory used 323,157k (± 0.00%) 323,139k (± 0.00%) -18k (- 0.01%) 323,112k 323,175k
Parse Time 1.56s (± 0.69%) 1.58s (± 0.55%) +0.02s (+ 1.09%) 1.56s 1.60s
Bind Time 0.74s (± 0.66%) 0.75s (± 0.40%) +0.00s (+ 0.54%) 0.74s 0.75s
Check Time 5.20s (± 0.32%) 5.23s (± 0.65%) +0.03s (+ 0.50%) 5.16s 5.31s
Emit Time 3.07s (± 0.71%) 3.10s (± 0.71%) +0.03s (+ 1.11%) 3.05s 3.16s
Total Time 10.58s (± 0.35%) 10.66s (± 0.47%) +0.08s (+ 0.76%) 10.55s 10.76s
TFS - node (v14.15.1, x64)
Memory used 287,671k (± 0.01%) 287,679k (± 0.00%) +7k (+ 0.00%) 287,658k 287,707k
Parse Time 1.28s (± 2.18%) 1.26s (± 0.71%) -0.02s (- 1.63%) 1.25s 1.29s
Bind Time 0.72s (± 1.51%) 0.72s (± 0.86%) -0.00s (- 0.42%) 0.71s 0.73s
Check Time 4.84s (± 1.16%) 4.82s (± 0.60%) -0.02s (- 0.33%) 4.77s 4.88s
Emit Time 3.23s (± 0.96%) 3.21s (± 0.58%) -0.01s (- 0.43%) 3.16s 3.24s
Total Time 10.07s (± 1.12%) 10.02s (± 0.47%) -0.05s (- 0.54%) 9.91s 10.11s
material-ui - node (v14.15.1, x64)
Memory used 450,147k (± 0.01%) 450,000k (± 0.06%) -147k (- 0.03%) 449,061k 450,295k
Parse Time 1.99s (± 0.65%) 1.99s (± 0.44%) -0.00s (- 0.00%) 1.97s 2.00s
Bind Time 0.70s (± 1.14%) 0.70s (± 0.95%) -0.00s (- 0.28%) 0.69s 0.71s
Check Time 12.95s (± 0.58%) 13.02s (± 0.67%) +0.07s (+ 0.56%) 12.85s 13.24s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.64s (± 0.53%) 15.71s (± 0.57%) +0.07s (+ 0.45%) 15.56s 15.93s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-206-generic
Architecturex64
Available Memory16 GB
Available Memory6 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
Benchmark Name Iterations
Current 44100 10
Baseline master 10

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

Hey @amcasey, something went wrong when publishing results. (You can check the log here).

@rbuckton
Copy link
Member

This isn't exactly a "noop", instead we're now scanning the entire string twice (once for the indexOf, and once for the regexp). If the RegExp's performance is poor, we could rewrite it in terms of the result of indexOf:

    export function normalizeSlashes(path: string): string {
        let index = path.indexOf(altDirectorySeparator);
        if (index !== -1) {
            let newPath = path.slice(0, index) + "/";
            let start = index + 1;
            index = path.indexOf(altDirectorySeparator, start);
            while (index !== -1) {
                newPath += path.slice(start, index) + "/";
                start = index + 1;
                index = path.indexOf(altDirectorySeparator, start);
            }
            return newPath + path.slice(start);
        }
        return path;
    }

@rbuckton
Copy link
Member

Hmm. Seems like Daniel's might be more efficient?

    normalize 100 paths
    ┌────────────────────────────────────┬────────────┬─────────┬───────────┬──────────────────┬─────────┐
    │ name                               │ date       │ samples │ duration  │ run slower ratio │ % error │
    ├────────────────────────────────────┼────────────┼─────────┼───────────┼──────────────────┼─────────┤
    │ normalizePathUsingRegExp           │ 5/14/2021, │ 94      │ 19.157 µs │ 4.435x           │ 0.827 % │
    │                                    │ 6:14:46 PM │         │           │                  │         │
    ├────────────────────────────────────┼────────────┼─────────┼───────────┼──────────────────┼─────────┤
    │ normalizePathUsingIndexOfAndRegExp │ 5/14/2021, │ 91      │ 20.552 µs │ 4.758x           │ 1.154 % │
    │                                    │ 6:14:46 PM │         │           │                  │         │
    ├────────────────────────────────────┼────────────┼─────────┼───────────┼──────────────────┼─────────┤
    │ normalizePathUsingIndexOf          │ 5/14/2021, │ 83      │ 11.086 µs │ 2.567x           │ 3.463 % │
    │                                    │ 6:14:46 PM │         │           │                  │         │
    ├────────────────────────────────────┼────────────┼─────────┼───────────┼──────────────────┼─────────┤
    │ normalizePathUsingIndexOfAndArray  │ 5/14/2021, │ 96      │ 4.319 µs  │ 1.000x           │ 1.674 % │
    │                                    │ 6:14:46 PM │         │           │                  │         │
    └────────────────────────────────────┴────────────┴─────────┴───────────┴──────────────────┴─────────┘

I'm generating a bunch of random paths with random character separators, and this is just quick and dirty. I can look at improving my microbenchmark sample size after I get some dinner.

@DanielRosenwasser
Copy link
Member

I wonder how well it would work with the single static buffer case.

    const normalizeSlashesSegmentBuffer: string[] = [];
    /**
     * Normalize path separators, converting `\` into `/`.
     */
    export function normalizeSlashes(path: string): string {
        normalizeSlashesSegmentBuffer.length = 0;
        let lastSliceStart = 0;
        for (let i = 0; i < path.length; i++) {
            const c = path.charCodeAt(i);
            if (c === CharacterCodes.backslash) {
                normalizeSlashesSegmentBuffer.push(path.slice(lastSliceStart, i));
                lastSliceStart = i + 1;
            }
        }
        if (normalizeSlashesSegmentBuffer.length > 0) {
            normalizeSlashesSegmentBuffer.push(path.slice(lastSliceStart));
            return normalizeSlashesSegmentBuffer.join(directorySeparator);
        }
        return path;
    }

@rbuckton
Copy link
Member

rbuckton commented May 15, 2021

The shared array case seems to be slower, but I also modified @DanielRosenwasser's code to use String.prototype.concat without using an array and that seems to be fairly efficient:

    normalize 100000 paths
    ┌───────────────────────────────────────────────┬────────────┬─────────┬──────────────┬──────────────────┬─────────┐
    │ name                                          │ date       │ samples │ duration     │ run slower ratio │ % error │
    ├───────────────────────────────────────────────┼────────────┼─────────┼──────────────┼──────────────────┼─────────┤
    │ normalizeSlashesUsingRegExp                   │ 5/14/2021, │ 60      │ 21775.894 µs │ 4.224x           │ 0.672 % │
    │                                               │ 9:42:42 PM │         │              │                  │         │
    ├───────────────────────────────────────────────┼────────────┼─────────┼──────────────┼──────────────────┼─────────┤
    │ normalizeSlashesUsingIndexOfAndRegExp         │ 5/14/2021, │ 58      │ 22876.267 µs │ 4.438x           │ 0.786 % │
    │                                               │ 9:42:42 PM │         │              │                  │         │
    ├───────────────────────────────────────────────┼────────────┼─────────┼──────────────┼──────────────────┼─────────┤
    │ normalizeSlashesUsingIndexOfAndRegExp2        │ 5/14/2021, │ 54      │ 24327.792 µs │ 4.719x           │ 1.514 % │
    │                                               │ 9:42:42 PM │         │              │                  │         │
    ├───────────────────────────────────────────────┼────────────┼─────────┼──────────────┼──────────────────┼─────────┤
    │ normalizeSlashesUsingIndexOf                  │ 5/14/2021, │ 64      │ 16076.465 µs │ 3.119x           │ 2.375 % │
    │                                               │ 9:42:42 PM │         │              │                  │         │
    ├───────────────────────────────────────────────┼────────────┼─────────┼──────────────┼──────────────────┼─────────┤
    │ normalizeSlashesUsingCharCodeAt               │ 5/14/2021, │ 82      │ 5154.756 µs  │ 1.000x           │ 1.517 % │
    │                                               │ 9:42:42 PM │         │              │                  │         │
    ├───────────────────────────────────────────────┼────────────┼─────────┼──────────────┼──────────────────┼─────────┤
    │ normalizeSlashesUsingCharCodeAtAndArray       │ 5/14/2021, │ 77      │ 6227.908 µs  │ 1.208x           │ 6.419 % │
    │                                               │ 9:42:42 PM │         │              │                  │         │
    ├───────────────────────────────────────────────┼────────────┼─────────┼──────────────┼──────────────────┼─────────┤
    │ normalizeSlashesUsingCharCodeAtAndSharedArray │ 5/14/2021, │ 69      │ 12255.605 µs │ 2.378x           │ 7.006 % │
    │                                               │ 9:42:42 PM │         │              │                  │         │
    └───────────────────────────────────────────────┴────────────┴─────────┴──────────────┴──────────────────┴─────────┘
function normalizeSlashes(path: string): string {
    let lastSliceStart = 0;
    let newPath: string | undefined;
    for (let i = 0; i < path.length; i++) {
        const c = path.charCodeAt(i);
        if (c === CharacterCodes.backslash) {
            const segment = path.slice(lastSliceStart, i);
            lastSliceStart = i + 1;
            newPath = newPath === undefined ? segment : newPath.concat(directorySeparator, segment);
        }
    }
    return newPath === undefined ? path : newPath.concat(directorySeparator, path.slice(lastSliceStart));
}

@DanielRosenwasser
Copy link
Member

Interesting - I guess I would just check on how that works in the original code sample in case the resulting string representations end up making a difference later on.

@amcasey
Copy link
Member Author

amcasey commented May 17, 2021

This isn't exactly a "noop"

I meant that it was a no-op in the case where the slashes are already normalized. Obviously, it's wasted work (though not much - a traversal up to the first slash) in the case where normalization is required.

we're now scanning the entire string twice

We're only going to scan the entire string for indexOf if the first backslash is the last character. I claim that that's rare in practice.

If the RegExp's performance is poor, we could rewrite it in terms of the result of indexOf:

My first attempt was to unroll it. It made things much worse (tripled the time in the real-world sample). Even if we write one that shows improved performance on a micro-benchmark, my concern is that any replacement happening in JS, rather than native code, will produce a lot of temporary strings.

If you settle on a winner based on microbenchmarks, I'm happy to drop it into the real repro to see what difference it makes.

@amcasey amcasey changed the title Make normalizeSlashes a no-op there are no bad slashes Make normalizeSlashes a no-op when there are no bad slashes May 17, 2021
@amcasey
Copy link
Member Author

amcasey commented May 17, 2021

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 17, 2021

Heya @amcasey, I've started to run the perf test suite on this PR at 0c797a5. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@amcasey
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..44100

Metric master 44100 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 345,047k (± 0.01%) 345,221k (± 0.02%) +173k (+ 0.05%) 345,105k 345,395k
Parse Time 1.90s (± 0.72%) 1.92s (± 0.55%) +0.02s (+ 1.00%) 1.90s 1.95s
Bind Time 0.84s (± 0.80%) 0.83s (± 0.44%) -0.00s (- 0.24%) 0.83s 0.84s
Check Time 5.25s (± 0.68%) 5.28s (± 0.52%) +0.02s (+ 0.48%) 5.23s 5.34s
Emit Time 5.57s (± 0.59%) 5.60s (± 0.88%) +0.03s (+ 0.50%) 5.53s 5.76s
Total Time 13.57s (± 0.41%) 13.63s (± 0.38%) +0.06s (+ 0.48%) 13.54s 13.79s
Compiler-Unions - node (v10.16.3, x64)
Memory used 200,388k (± 0.03%) 200,339k (± 0.04%) -49k (- 0.02%) 200,160k 200,584k
Parse Time 0.78s (± 0.46%) 0.78s (± 0.93%) -0.00s (- 0.26%) 0.76s 0.80s
Bind Time 0.53s (± 1.29%) 0.53s (± 0.98%) +0.00s (+ 0.57%) 0.52s 0.54s
Check Time 7.53s (± 0.48%) 7.56s (± 0.90%) +0.04s (+ 0.48%) 7.45s 7.78s
Emit Time 2.45s (± 0.93%) 2.46s (± 0.86%) +0.01s (+ 0.37%) 2.40s 2.51s
Total Time 11.29s (± 0.38%) 11.34s (± 0.73%) +0.05s (+ 0.44%) 11.21s 11.59s
Monaco - node (v10.16.3, x64)
Memory used 341,667k (± 0.02%) 341,683k (± 0.02%) +17k (+ 0.00%) 341,549k 341,862k
Parse Time 1.55s (± 0.60%) 1.55s (± 0.74%) -0.00s (- 0.13%) 1.52s 1.58s
Bind Time 0.74s (± 0.75%) 0.74s (± 0.63%) -0.00s (- 0.27%) 0.73s 0.75s
Check Time 5.39s (± 0.70%) 5.39s (± 0.59%) +0.00s (+ 0.06%) 5.33s 5.49s
Emit Time 2.97s (± 0.70%) 2.98s (± 0.55%) +0.02s (+ 0.51%) 2.94s 3.03s
Total Time 10.65s (± 0.53%) 10.67s (± 0.41%) +0.02s (+ 0.14%) 10.57s 10.79s
TFS - node (v10.16.3, x64)
Memory used 304,248k (± 0.02%) 304,207k (± 0.01%) -41k (- 0.01%) 304,107k 304,280k
Parse Time 1.21s (± 0.46%) 1.21s (± 0.60%) -0.00s (- 0.00%) 1.20s 1.23s
Bind Time 0.71s (± 0.67%) 0.70s (± 0.48%) -0.00s (- 0.57%) 0.70s 0.71s
Check Time 4.84s (± 0.47%) 4.89s (± 0.80%) +0.04s (+ 0.91%) 4.80s 4.97s
Emit Time 3.14s (± 1.19%) 3.13s (± 1.57%) -0.02s (- 0.54%) 3.00s 3.22s
Total Time 9.90s (± 0.45%) 9.92s (± 0.54%) +0.03s (+ 0.25%) 9.83s 10.05s
material-ui - node (v10.16.3, x64)
Memory used 474,028k (± 0.01%) 474,015k (± 0.01%) -13k (- 0.00%) 473,846k 474,168k
Parse Time 1.94s (± 0.89%) 1.92s (± 0.54%) -0.02s (- 1.03%) 1.90s 1.94s
Bind Time 0.66s (± 0.76%) 0.65s (± 0.95%) -0.01s (- 0.92%) 0.63s 0.66s
Check Time 14.24s (± 0.35%) 14.23s (± 0.49%) -0.01s (- 0.07%) 14.13s 14.46s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.84s (± 0.32%) 16.80s (± 0.41%) -0.03s (- 0.20%) 16.71s 17.03s
Angular - node (v12.1.0, x64)
Memory used 322,607k (± 0.02%) 322,645k (± 0.02%) +38k (+ 0.01%) 322,531k 322,777k
Parse Time 1.90s (± 0.63%) 1.90s (± 0.49%) -0.00s (- 0.16%) 1.87s 1.91s
Bind Time 0.82s (± 0.71%) 0.82s (± 0.75%) +0.00s (+ 0.24%) 0.81s 0.83s
Check Time 5.15s (± 0.32%) 5.15s (± 0.29%) -0.00s (- 0.02%) 5.11s 5.18s
Emit Time 5.78s (± 0.80%) 5.74s (± 0.67%) -0.04s (- 0.73%) 5.69s 5.87s
Total Time 13.66s (± 0.48%) 13.62s (± 0.37%) -0.04s (- 0.31%) 13.50s 13.75s
Compiler-Unions - node (v12.1.0, x64)
Memory used 187,549k (± 0.16%) 187,478k (± 0.11%) -70k (- 0.04%) 187,078k 187,954k
Parse Time 0.77s (± 0.78%) 0.77s (± 1.01%) +0.01s (+ 0.65%) 0.76s 0.79s
Bind Time 0.53s (± 1.32%) 0.53s (± 0.64%) +0.00s (+ 0.38%) 0.53s 0.54s
Check Time 7.04s (± 0.64%) 7.03s (± 0.57%) -0.00s (- 0.04%) 6.98s 7.16s
Emit Time 2.43s (± 1.68%) 2.42s (± 1.39%) -0.02s (- 0.70%) 2.35s 2.53s
Total Time 10.77s (± 0.65%) 10.75s (± 0.48%) -0.01s (- 0.12%) 10.64s 10.85s
Monaco - node (v12.1.0, x64)
Memory used 323,988k (± 0.05%) 323,940k (± 0.04%) -48k (- 0.01%) 323,408k 324,082k
Parse Time 1.54s (± 0.66%) 1.54s (± 0.70%) +0.00s (+ 0.20%) 1.52s 1.57s
Bind Time 0.72s (± 0.83%) 0.71s (± 0.52%) -0.00s (- 0.14%) 0.71s 0.72s
Check Time 5.21s (± 0.36%) 5.22s (± 0.51%) +0.01s (+ 0.12%) 5.17s 5.30s
Emit Time 3.04s (± 1.05%) 3.06s (± 2.31%) +0.02s (+ 0.76%) 2.98s 3.31s
Total Time 10.50s (± 0.38%) 10.53s (± 0.71%) +0.03s (+ 0.27%) 10.41s 10.77s
TFS - node (v12.1.0, x64)
Memory used 288,704k (± 0.02%) 288,723k (± 0.02%) +19k (+ 0.01%) 288,585k 288,821k
Parse Time 1.21s (± 0.62%) 1.20s (± 0.79%) -0.00s (- 0.25%) 1.18s 1.22s
Bind Time 0.70s (± 0.99%) 0.69s (± 0.84%) -0.00s (- 0.29%) 0.68s 0.70s
Check Time 4.76s (± 0.29%) 4.76s (± 0.53%) +0.01s (+ 0.17%) 4.71s 4.81s
Emit Time 3.13s (± 0.77%) 3.13s (± 0.82%) +0.00s (+ 0.16%) 3.08s 3.18s
Total Time 9.78s (± 0.32%) 9.79s (± 0.38%) +0.01s (+ 0.12%) 9.72s 9.86s
material-ui - node (v12.1.0, x64)
Memory used 451,959k (± 0.01%) 451,842k (± 0.06%) -117k (- 0.03%) 450,743k 452,122k
Parse Time 1.95s (± 0.56%) 1.94s (± 0.57%) -0.01s (- 0.67%) 1.91s 1.96s
Bind Time 0.64s (± 0.87%) 0.64s (± 0.47%) -0.00s (- 0.00%) 0.63s 0.64s
Check Time 12.81s (± 0.48%) 12.82s (± 0.53%) +0.02s (+ 0.13%) 12.69s 12.99s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.40s (± 0.40%) 15.40s (± 0.46%) +0.00s (+ 0.03%) 15.27s 15.57s
Angular - node (v14.15.1, x64)
Memory used 321,295k (± 0.00%) 321,297k (± 0.08%) +2k (+ 0.00%) 320,281k 321,439k
Parse Time 1.91s (± 0.70%) 1.91s (± 0.80%) -0.00s (- 0.21%) 1.88s 1.94s
Bind Time 0.87s (± 0.34%) 0.87s (± 0.85%) +0.00s (+ 0.58%) 0.86s 0.89s
Check Time 5.17s (± 0.41%) 5.19s (± 0.75%) +0.02s (+ 0.39%) 5.12s 5.27s
Emit Time 5.81s (± 0.36%) 5.88s (± 1.12%) +0.07s (+ 1.20%) 5.77s 6.10s
Total Time 13.76s (± 0.32%) 13.86s (± 0.69%) +0.10s (+ 0.70%) 13.67s 14.14s
Compiler-Unions - node (v14.15.1, x64)
Memory used 188,755k (± 0.58%) 188,112k (± 0.64%) -643k (- 0.34%) 186,440k 189,797k
Parse Time 0.80s (± 0.50%) 0.80s (± 0.50%) +0.00s (+ 0.00%) 0.79s 0.81s
Bind Time 0.55s (± 0.62%) 0.56s (± 0.65%) +0.00s (+ 0.54%) 0.55s 0.56s
Check Time 7.14s (± 0.47%) 7.14s (± 0.52%) +0.00s (+ 0.01%) 7.08s 7.24s
Emit Time 2.44s (± 0.91%) 2.43s (± 0.53%) -0.01s (- 0.57%) 2.41s 2.46s
Total Time 10.93s (± 0.38%) 10.93s (± 0.43%) -0.01s (- 0.07%) 10.85s 11.03s
Monaco - node (v14.15.1, x64)
Memory used 323,157k (± 0.00%) 323,131k (± 0.01%) -27k (- 0.01%) 323,097k 323,177k
Parse Time 1.56s (± 0.69%) 1.57s (± 0.44%) +0.00s (+ 0.26%) 1.55s 1.58s
Bind Time 0.74s (± 0.66%) 0.75s (± 0.50%) +0.00s (+ 0.13%) 0.74s 0.75s
Check Time 5.20s (± 0.32%) 5.20s (± 0.44%) -0.00s (- 0.00%) 5.16s 5.25s
Emit Time 3.07s (± 0.71%) 3.08s (± 0.71%) +0.01s (+ 0.26%) 3.03s 3.13s
Total Time 10.58s (± 0.35%) 10.59s (± 0.37%) +0.01s (+ 0.09%) 10.51s 10.67s
TFS - node (v14.15.1, x64)
Memory used 287,671k (± 0.01%) 287,681k (± 0.01%) +9k (+ 0.00%) 287,652k 287,742k
Parse Time 1.28s (± 2.18%) 1.28s (± 0.82%) -0.00s (- 0.39%) 1.27s 1.32s
Bind Time 0.72s (± 1.51%) 0.71s (± 0.48%) -0.01s (- 1.25%) 0.71s 0.72s
Check Time 4.84s (± 1.16%) 4.80s (± 0.49%) -0.03s (- 0.70%) 4.76s 4.86s
Emit Time 3.23s (± 0.96%) 3.19s (± 0.46%) -0.03s (- 1.05%) 3.15s 3.22s
Total Time 10.07s (± 1.12%) 9.99s (± 0.37%) -0.08s (- 0.80%) 9.91s 10.07s
material-ui - node (v14.15.1, x64)
Memory used 450,147k (± 0.01%) 449,922k (± 0.08%) -226k (- 0.05%) 448,974k 450,238k
Parse Time 1.99s (± 0.65%) 1.98s (± 1.06%) -0.01s (- 0.25%) 1.94s 2.04s
Bind Time 0.70s (± 1.14%) 0.70s (± 0.82%) -0.00s (- 0.28%) 0.69s 0.71s
Check Time 12.95s (± 0.58%) 13.10s (± 1.29%) +0.16s (+ 1.20%) 12.86s 13.49s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.64s (± 0.53%) 15.79s (± 1.15%) +0.15s (+ 0.94%) 15.53s 16.21s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-206-generic
Architecturex64
Available Memory16 GB
Available Memory6 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
Benchmark Name Iterations
Current 44100 10
Baseline master 10

Developer Information:

Download Benchmark

@rbuckton
Copy link
Member

@amcasey Hope you don't mind, I'm going to borrow this PR to run the perf test pipeline to make sure it is working...
@typescript-bot perf test

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 18, 2021

Heya @rbuckton, I've started to run the perf test suite on this PR at 0c797a5. You can monitor the build here.

@rbuckton
Copy link
Member

It didn't work, so I'm going to create a different PR to test things out on...

@amcasey
Copy link
Member Author

amcasey commented May 18, 2021

Building typescript on windows, I see 73549 calls to normalizeSlashes. Of those, 70013 (95.2%) return the input string. I claim indexOf is the fastest way to detect that no work is required.

Edit: my ts was out of date and had compilation errors. Updated.

@rbuckton
Copy link
Member

Which did you test? The one at the bottom of #44100 (comment) was the run that performed the best in my microbenchmarks on windows.

@amcasey
Copy link
Member Author

amcasey commented May 18, 2021

@rbuckton, when you benchmarked, were 95% of your inputs already normalized?

I realize numbers are the final arbiter in any perf debate, but I'm having trouble imagining how anything in JS-space could be faster than a native indexOf (which also, I would think, produces no garbage).

@dmichon-msft
Copy link
Contributor

One thing to be aware of when running micro benchmarks on string concatenation: on v8, concatenation using the + operator is effectively deferred until the moment you attempt to perform an operation on the resulting string that requires it to be iterated or similar. For example, if you call Buffer.from() on the output, suddenly Array.join() and + have the same performance.

@amcasey
Copy link
Member Author

amcasey commented May 18, 2021

@dmichon-msft Good point. I also think it's easy to miss GC costs in a micro-benchmark.

@amcasey
Copy link
Member Author

amcasey commented May 18, 2021

@DanielRosenwasser I think #44101 is your preferred variant. Is that correct?
@rbuckton I can't tell which version you'd like me to test. Can you please create a new comment with your preferred variant?

@rbuckton
Copy link
Member

@amcasey: This is the version that seemed to be winning in my microbenchmarks:

function normalizeSlashes(path: string): string {
    let lastSliceStart = 0;
    let newPath: string | undefined;
    for (let i = 0; i < path.length; i++) {
        const c = path.charCodeAt(i);
        if (c === CharacterCodes.backslash) {
            const segment = path.slice(lastSliceStart, i);
            lastSliceStart = i + 1;
            newPath = newPath === undefined ? segment : newPath.concat(directorySeparator, segment);
        }
    }
    return newPath === undefined ? path : newPath.concat(directorySeparator, path.slice(lastSliceStart));
}

@amcasey
Copy link
Member Author

amcasey commented May 19, 2021

@rbuckton Single run on linux with node12

PR version

Duration: 36.94s, Total samples = 34285ms (92.81%)
Active filters:
   show=normalizeSlashes
Showing nodes accounting for 499ms, 1.46% of 34285ms total
      flat  flat%   sum%        cum   cum%
     499ms  1.46%  1.46%      499ms  1.46%  normalizeSlashes

Micro-benchmark winner

Duration: 43.94s, Total samples = 40.84s (92.95%)
Active filters:
   show=normalizeSlashes
Showing nodes accounting for 2.04s, 4.99% of 40.84s total
      flat  flat%   sum%        cum   cum%
     2.04s  4.99%  4.99%      2.04s  4.99%  normalizeSlashes

@amcasey
Copy link
Member Author

amcasey commented May 19, 2021

pprof isn't cooperating, but here are the server-reported times for node16 (single run):

PR:

updateGraphDurationMs: 35821.50540602207

Micro-benchmark winner:

updateGraphDurationMs: 41335.72825098038

@amcasey amcasey changed the title Make normalizeSlashes a no-op when there are no bad slashes Avoid calling replace in normalizeSlashes when it would do nothing May 19, 2021
@dmichon-msft
Copy link
Contributor

@amcasey queue a regular perf test to ensure there isn't a regression in the benchmarks?

@amcasey
Copy link
Member Author

amcasey commented May 20, 2021

@dmichon-msft Sure, but there won't be because they're all linux tests without backslashes.

@amcasey
Copy link
Member Author

amcasey commented May 20, 2021

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 20, 2021

Heya @amcasey, I've started to run the perf test suite on this PR at aaaf09f. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@amcasey
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..44100

Metric master 44100 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 345,228k (± 0.02%) 345,236k (± 0.03%) +7k (+ 0.00%) 345,073k 345,499k
Parse Time 1.91s (± 0.66%) 1.91s (± 0.47%) +0.00s (+ 0.10%) 1.89s 1.93s
Bind Time 0.83s (± 0.71%) 0.84s (± 1.03%) +0.00s (+ 0.48%) 0.83s 0.87s
Check Time 5.25s (± 0.44%) 5.26s (± 0.36%) +0.01s (+ 0.19%) 5.23s 5.30s
Emit Time 5.54s (± 0.61%) 5.53s (± 0.44%) -0.02s (- 0.29%) 5.49s 5.59s
Total Time 13.54s (± 0.29%) 13.54s (± 0.27%) -0.00s (- 0.00%) 13.47s 13.63s
Compiler-Unions - node (v10.16.3, x64)
Memory used 200,328k (± 0.04%) 200,390k (± 0.02%) +62k (+ 0.03%) 200,285k 200,462k
Parse Time 0.78s (± 0.74%) 0.78s (± 0.76%) +0.00s (+ 0.13%) 0.77s 0.80s
Bind Time 0.53s (± 1.71%) 0.53s (± 0.90%) -0.00s (- 0.38%) 0.51s 0.53s
Check Time 7.52s (± 0.42%) 7.49s (± 0.50%) -0.03s (- 0.35%) 7.43s 7.58s
Emit Time 2.23s (± 0.92%) 2.24s (± 0.73%) +0.01s (+ 0.40%) 2.19s 2.27s
Total Time 11.06s (± 0.35%) 11.04s (± 0.34%) -0.02s (- 0.17%) 10.97s 11.11s
Monaco - node (v10.16.3, x64)
Memory used 341,633k (± 0.02%) 341,655k (± 0.02%) +23k (+ 0.01%) 341,467k 341,761k
Parse Time 1.55s (± 0.53%) 1.54s (± 0.54%) -0.01s (- 0.58%) 1.53s 1.57s
Bind Time 0.74s (± 0.66%) 0.74s (± 0.70%) -0.00s (- 0.40%) 0.73s 0.75s
Check Time 5.41s (± 0.56%) 5.38s (± 0.39%) -0.02s (- 0.44%) 5.35s 5.45s
Emit Time 2.98s (± 0.81%) 2.96s (± 0.35%) -0.03s (- 0.87%) 2.94s 2.98s
Total Time 10.69s (± 0.48%) 10.63s (± 0.26%) -0.06s (- 0.53%) 10.58s 10.73s
TFS - node (v10.16.3, x64)
Memory used 304,188k (± 0.02%) 304,261k (± 0.04%) +73k (+ 0.02%) 304,077k 304,593k
Parse Time 1.21s (± 0.48%) 1.21s (± 0.72%) -0.00s (- 0.17%) 1.19s 1.23s
Bind Time 0.71s (± 0.85%) 0.71s (± 0.87%) +0.00s (+ 0.57%) 0.70s 0.73s
Check Time 4.85s (± 0.46%) 4.84s (± 0.63%) -0.01s (- 0.14%) 4.79s 4.93s
Emit Time 3.12s (± 0.92%) 3.13s (± 0.91%) +0.01s (+ 0.38%) 3.06s 3.17s
Total Time 9.88s (± 0.37%) 9.88s (± 0.47%) +0.00s (+ 0.01%) 9.80s 10.03s
material-ui - node (v10.16.3, x64)
Memory used 474,173k (± 0.01%) 474,093k (± 0.02%) -79k (- 0.02%) 473,908k 474,359k
Parse Time 1.94s (± 0.33%) 1.91s (± 0.56%) -0.02s (- 1.19%) 1.89s 1.94s
Bind Time 0.65s (± 0.95%) 0.65s (± 0.89%) +0.00s (+ 0.62%) 0.64s 0.67s
Check Time 14.19s (± 0.22%) 14.22s (± 0.51%) +0.03s (+ 0.22%) 14.08s 14.37s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.77s (± 0.20%) 16.78s (± 0.46%) +0.01s (+ 0.06%) 16.64s 16.94s
Angular - node (v12.1.0, x64)
Memory used 322,679k (± 0.02%) 322,657k (± 0.02%) -22k (- 0.01%) 322,455k 322,867k
Parse Time 1.90s (± 0.64%) 1.90s (± 0.56%) -0.00s (- 0.16%) 1.87s 1.92s
Bind Time 0.82s (± 0.63%) 0.82s (± 0.91%) +0.00s (+ 0.24%) 0.81s 0.85s
Check Time 5.15s (± 0.29%) 5.16s (± 0.35%) +0.01s (+ 0.14%) 5.12s 5.20s
Emit Time 5.74s (± 0.46%) 5.77s (± 1.30%) +0.03s (+ 0.56%) 5.70s 6.06s
Total Time 13.61s (± 0.21%) 13.65s (± 0.63%) +0.03s (+ 0.25%) 13.53s 13.95s
Compiler-Unions - node (v12.1.0, x64)
Memory used 187,815k (± 0.07%) 187,582k (± 0.15%) -234k (- 0.12%) 186,845k 188,036k
Parse Time 0.77s (± 1.36%) 0.77s (± 0.64%) -0.01s (- 0.91%) 0.76s 0.78s
Bind Time 0.53s (± 1.59%) 0.53s (± 0.42%) +0.00s (+ 0.00%) 0.53s 0.54s
Check Time 7.05s (± 1.23%) 7.04s (± 0.56%) -0.02s (- 0.23%) 6.97s 7.15s
Emit Time 2.24s (± 1.15%) 2.28s (± 1.75%) +0.04s (+ 1.65%) 2.22s 2.41s
Total Time 10.60s (± 0.93%) 10.61s (± 0.70%) +0.01s (+ 0.10%) 10.50s 10.85s
Monaco - node (v12.1.0, x64)
Memory used 324,064k (± 0.02%) 323,910k (± 0.08%) -155k (- 0.05%) 322,888k 324,127k
Parse Time 1.53s (± 0.71%) 1.52s (± 0.38%) -0.01s (- 0.52%) 1.51s 1.54s
Bind Time 0.72s (± 0.51%) 0.72s (± 0.41%) +0.00s (+ 0.28%) 0.71s 0.72s
Check Time 5.21s (± 0.31%) 5.21s (± 0.57%) -0.00s (- 0.06%) 5.13s 5.30s
Emit Time 3.01s (± 0.40%) 3.03s (± 0.89%) +0.02s (+ 0.67%) 2.98s 3.10s
Total Time 10.47s (± 0.16%) 10.47s (± 0.46%) +0.01s (+ 0.09%) 10.36s 10.60s
TFS - node (v12.1.0, x64)
Memory used 288,695k (± 0.03%) 288,699k (± 0.02%) +5k (+ 0.00%) 288,590k 288,809k
Parse Time 1.21s (± 0.50%) 1.20s (± 0.51%) -0.00s (- 0.33%) 1.19s 1.21s
Bind Time 0.70s (± 0.53%) 0.69s (± 0.64%) -0.00s (- 0.43%) 0.68s 0.70s
Check Time 4.77s (± 0.64%) 4.76s (± 0.24%) -0.01s (- 0.29%) 4.73s 4.78s
Emit Time 3.13s (± 0.40%) 3.12s (± 0.80%) -0.01s (- 0.26%) 3.04s 3.16s
Total Time 9.80s (± 0.32%) 9.77s (± 0.32%) -0.03s (- 0.29%) 9.67s 9.83s
material-ui - node (v12.1.0, x64)
Memory used 451,822k (± 0.08%) 451,786k (± 0.06%) -36k (- 0.01%) 450,905k 452,070k
Parse Time 1.94s (± 0.45%) 1.93s (± 0.81%) -0.02s (- 0.82%) 1.91s 1.98s
Bind Time 0.64s (± 0.63%) 0.64s (± 0.69%) +0.00s (+ 0.47%) 0.63s 0.65s
Check Time 12.83s (± 0.80%) 12.84s (± 0.57%) +0.02s (+ 0.14%) 12.73s 13.00s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.41s (± 0.64%) 15.41s (± 0.50%) +0.00s (+ 0.01%) 15.27s 15.57s
Angular - node (v14.15.1, x64)
Memory used 321,429k (± 0.00%) 321,417k (± 0.00%) -12k (- 0.00%) 321,389k 321,447k
Parse Time 1.90s (± 0.60%) 1.90s (± 0.85%) -0.00s (- 0.16%) 1.87s 1.93s
Bind Time 0.87s (± 0.75%) 0.87s (± 0.51%) 0.00s ( 0.00%) 0.86s 0.88s
Check Time 5.15s (± 0.40%) 5.17s (± 0.50%) +0.02s (+ 0.39%) 5.12s 5.25s
Emit Time 5.78s (± 0.36%) 5.78s (± 0.62%) +0.00s (+ 0.03%) 5.69s 5.88s
Total Time 13.70s (± 0.29%) 13.72s (± 0.45%) +0.02s (+ 0.15%) 13.61s 13.92s
Compiler-Unions - node (v14.15.1, x64)
Memory used 189,101k (± 0.51%) 189,397k (± 0.38%) +296k (+ 0.16%) 186,482k 189,783k
Parse Time 0.80s (± 0.81%) 0.80s (± 0.72%) -0.00s (- 0.25%) 0.79s 0.82s
Bind Time 0.56s (± 0.61%) 0.56s (± 0.65%) -0.00s (- 0.18%) 0.55s 0.56s
Check Time 7.13s (± 0.42%) 7.16s (± 0.51%) +0.03s (+ 0.38%) 7.09s 7.26s
Emit Time 2.24s (± 0.68%) 2.27s (± 0.91%) +0.04s (+ 1.56%) 2.24s 2.33s
Total Time 10.73s (± 0.30%) 10.79s (± 0.43%) +0.06s (+ 0.56%) 10.71s 10.92s
Monaco - node (v14.15.1, x64)
Memory used 323,145k (± 0.01%) 323,133k (± 0.01%) -12k (- 0.00%) 323,092k 323,158k
Parse Time 1.57s (± 0.48%) 1.56s (± 0.40%) -0.01s (- 0.38%) 1.55s 1.58s
Bind Time 0.75s (± 0.82%) 0.75s (± 0.67%) -0.00s (- 0.53%) 0.74s 0.76s
Check Time 5.22s (± 0.43%) 5.20s (± 0.57%) -0.02s (- 0.31%) 5.14s 5.28s
Emit Time 3.06s (± 0.55%) 3.08s (± 0.73%) +0.02s (+ 0.75%) 3.04s 3.15s
Total Time 10.59s (± 0.25%) 10.58s (± 0.35%) -0.01s (- 0.06%) 10.48s 10.65s
TFS - node (v14.15.1, x64)
Memory used 287,680k (± 0.01%) 287,678k (± 0.01%) -2k (- 0.00%) 287,629k 287,710k
Parse Time 1.27s (± 1.60%) 1.26s (± 0.99%) -0.00s (- 0.16%) 1.25s 1.31s
Bind Time 0.72s (± 0.95%) 0.71s (± 0.70%) -0.00s (- 0.14%) 0.70s 0.72s
Check Time 4.80s (± 0.43%) 4.81s (± 0.60%) +0.01s (+ 0.15%) 4.73s 4.86s
Emit Time 3.21s (± 0.91%) 3.21s (± 0.61%) -0.00s (- 0.09%) 3.17s 3.25s
Total Time 10.00s (± 0.47%) 9.99s (± 0.31%) -0.00s (- 0.01%) 9.92s 10.08s
material-ui - node (v14.15.1, x64)
Memory used 450,067k (± 0.06%) 450,175k (± 0.00%) +107k (+ 0.02%) 450,134k 450,216k
Parse Time 1.99s (± 0.62%) 1.97s (± 0.51%) -0.02s (- 0.91%) 1.95s 1.99s
Bind Time 0.69s (± 0.43%) 0.70s (± 0.80%) +0.01s (+ 0.87%) 0.69s 0.71s
Check Time 12.95s (± 0.62%) 12.97s (± 0.43%) +0.02s (+ 0.13%) 12.85s 13.10s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.64s (± 0.53%) 15.64s (± 0.36%) +0.00s (+ 0.01%) 15.51s 15.78s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-206-generic
Architecturex64
Available Memory16 GB
Available Memory2 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
Benchmark Name Iterations
Current 44100 10
Baseline master 10

Developer Information:

Download Benchmark

@rbuckton
Copy link
Member

It doesn't seem to have a significant impact on existing benchmarks, so I'm happy with whatever version seems to improve your specific test case.

@amcasey amcasey merged commit 14343be into microsoft:master May 21, 2021
@amcasey amcasey deleted the NormSlash branch May 21, 2021 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants