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

path: refactor to use more primordials #36302

Closed
wants to merge 1 commit into from

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Nov 28, 2020

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the path Issues and PRs related to the path subsystem. label Nov 28, 2020
@aduh95
Copy link
Contributor Author

aduh95 commented Nov 30, 2020

Benchmark CI results:

                                                                                                  confidence improvement accuracy (*)    (**)   (***)
path/basename-posix.js n=100000 pathext='foo/bar.'                                                        **      6.21 %       ±4.46%  ±5.98%  ±7.86%
path/dirname-win32.js n=100000 path=''                                                                   ***     15.60 %       ±5.55%  ±7.42%  ±9.71%
path/dirname-win32.js n=100000 path='\\\\'                                                               ***     12.26 %       ±5.64%  ±7.51%  ±9.78%
path/dirname-win32.js n=100000 path='\\\\foo'                                                             **      8.48 %       ±5.62%  ±7.48%  ±9.74%
path/dirname-win32.js n=100000 path='foo\\\\bar'                                                           *     -5.76 %       ±4.67%  ±6.24%  ±8.19%
path/normalize-win32.js n=100000 path='C:\\\\foo'                                                         **     -5.72 %       ±3.58%  ±4.77%  ±6.21%
path/relative-win32.js n=100000 paths='C:\\\\foo\\\\bar\\\\baz|C:\\\\foo\\\\bar\\\\baz'                   **     -7.12 %       ±5.20%  ±6.94%  ±9.07%
path/resolve-posix.js n=100000 paths=''                                                                    *     -8.80 %       ±7.96% ±10.64% ±13.95%
 6.00 false positives, when considering a   5% risk acceptance (*, **, ***),
 1.20 false positives, when considering a   1% risk acceptance (**, ***),
 0.12 false positives, when considering a 0.1% risk acceptance (***)
                                                                                                  confidence improvement accuracy (*)    (**)   (***)
path/basename-posix.js n=100000 pathext='/'                                                                       0.82 %       ±3.55%  ±4.72%  ±6.15%
path/basename-posix.js n=100000 pathext=''                                                                        1.31 %       ±4.09%  ±5.46%  ±7.13%
path/basename-posix.js n=100000 pathext='/foo'                                                                    0.04 %       ±4.32%  ±5.76%  ±7.50%
path/basename-posix.js n=100000 pathext='foo'                                                                    -1.17 %       ±3.52%  ±4.69%  ±6.10%
path/basename-posix.js n=100000 pathext='foo/bar.|.'                                                             -0.16 %       ±3.78%  ±5.03%  ±6.55%
path/basename-posix.js n=100000 pathext='foo/bar.'                                                        **      6.21 %       ±4.46%  ±5.98%  ±7.86%
path/basename-posix.js n=100000 pathext='/foo/.bar.baz'                                                          -2.57 %       ±4.22%  ±5.63%  ±7.33%
path/basename-posix.js n=100000 pathext='/foo/bar/baz/asdf/quux.html'                                            -0.58 %       ±4.18%  ±5.56%  ±7.24%
path/basename-posix.js n=100000 pathext='/foo/bar/baz/asdf/quux.html|.html'                                      -3.03 %       ±4.42%  ±5.88%  ±7.65%
path/basename-posix.js n=100000 pathext='/foo/.bar.baz|.baz'                                                     -1.51 %       ±3.45%  ±4.60%  ±5.98%
path/basename-win32.js n=100000 pathext=''                                                                        2.06 %       ±4.82%  ±6.43%  ±8.39%
path/basename-win32.js n=100000 pathext='C:\\\\'                                                                  1.24 %       ±4.93%  ±6.56%  ±8.55%
path/basename-win32.js n=100000 pathext='C:\\\\foo'                                                              -0.53 %       ±4.72%  ±6.27%  ±8.17%
path/basename-win32.js n=100000 pathext='D:\\\\foo\\\\.bar.baz'                                                  -1.38 %       ±4.15%  ±5.53%  ±7.19%
path/basename-win32.js n=100000 pathext='E:\\\\foo\\\\.bar.baz|.baz'                                             -0.87 %       ±4.03%  ±5.37%  ±7.00%
path/basename-win32.js n=100000 pathext='foo'                                                                    -1.81 %       ±4.17%  ±5.57%  ±7.27%
path/basename-win32.js n=100000 pathext='foo\\\\bar.|.'                                                          -0.95 %       ±4.74%  ±6.31%  ±8.22%
path/basename-win32.js n=100000 pathext='foo\\\\bar.'                                                             3.67 %       ±4.72%  ±6.29%  ±8.18%
path/basename-win32.js n=100000 pathext='\\\\foo\\\\bar\\\\baz\\\\asdf\\\\quux.html'                             -2.26 %       ±4.54%  ±6.04%  ±7.86%
path/basename-win32.js n=100000 pathext='\\\\foo\\\\bar\\\\baz\\\\asdf\\\\quux.html|.html'                       -2.40 %       ±4.85%  ±6.46%  ±8.41%
path/dirname-posix.js n=100000 path='/'                                                                          -1.54 %       ±4.23%  ±5.63%  ±7.35%
path/dirname-posix.js n=100000 path=''                                                                           -2.91 %       ±4.99%  ±6.64%  ±8.66%
path/dirname-posix.js n=100000 path='/foo'                                                                       -1.94 %       ±4.69%  ±6.23%  ±8.12%
path/dirname-posix.js n=100000 path='foo'                                                                        -2.41 %       ±5.18%  ±6.91%  ±9.01%
path/dirname-posix.js n=100000 path='/foo/bar'                                                                    0.68 %       ±6.06%  ±8.07% ±10.51%
path/dirname-posix.js n=100000 path='foo/bar'                                                                     2.07 %       ±4.27%  ±5.69%  ±7.42%
path/dirname-posix.js n=100000 path='/foo/bar/baz/asdf/quux'                                                      4.79 %       ±6.64%  ±8.86% ±11.58%
path/dirname-win32.js n=100000 path=''                                                                   ***     15.60 %       ±5.55%  ±7.42%  ±9.71%
path/dirname-win32.js n=100000 path='\\\\'                                                               ***     12.26 %       ±5.64%  ±7.51%  ±9.78%
path/dirname-win32.js n=100000 path='C:\\\\foo\\\\bar'                                                           -2.25 %       ±6.70%  ±8.93% ±11.67%
path/dirname-win32.js n=100000 path='D:\\\\foo\\\\bar\\\\baz\\\\asdf\\\\quux'                                     2.85 %       ±7.96% ±10.62% ±13.88%
path/dirname-win32.js n=100000 path='\\\\foo'                                                             **      8.48 %       ±5.62%  ±7.48%  ±9.74%
path/dirname-win32.js n=100000 path='foo'                                                                         5.37 %       ±5.40%  ±7.21%  ±9.41%
path/dirname-win32.js n=100000 path='foo\\\\bar'                                                           *     -5.76 %       ±4.67%  ±6.24%  ±8.19%
path/extname-posix.js n=100000 path='/'                                                                          -2.69 %       ±5.59%  ±7.44%  ±9.70%
path/extname-posix.js n=100000 path=''                                                                            0.18 %       ±4.91%  ±6.53%  ±8.51%
path/extname-posix.js n=100000 path='/foo'                                                                        4.23 %       ±4.51%  ±6.03%  ±7.89%
path/extname-posix.js n=100000 path='foo/.bar.baz'                                                                1.75 %       ±5.59%  ±7.44%  ±9.68%
path/extname-posix.js n=100000 path='/foo/bar/baz/asdf/quux'                                                      4.38 %       ±6.11%  ±8.13% ±10.58%
path/extname-posix.js n=100000 path='/foo/bar/baz/asdf/quux.foobarbazasdfquux'                                   -0.68 %       ±5.57%  ±7.42%  ±9.68%
path/extname-posix.js n=100000 path='foo/bar/...baz.quux'                                                         2.98 %       ±6.39%  ±8.51% ±11.09%
path/extname-posix.js n=100000 path='foo/bar/..baz.quux'                                                          2.13 %       ±6.07%  ±8.08% ±10.53%
path/extname-posix.js n=100000 path='index'                                                                      -0.77 %       ±4.41%  ±5.86%  ±7.63%
path/extname-posix.js n=100000 path='index.html'                                                                  4.00 %       ±6.24%  ±8.32% ±10.85%
path/extname-win32.js n=100000 path=''                                                                            0.77 %       ±4.33%  ±5.77%  ±7.51%
path/extname-win32.js n=100000 path='\\\\'                                                                       -3.19 %       ±4.08%  ±5.44%  ±7.09%
path/extname-win32.js n=100000 path='C:\\\\foo'                                                                  -1.46 %       ±4.08%  ±5.43%  ±7.07%
path/extname-win32.js n=100000 path='D:\\\\foo\\\\bar\\\\baz\\\\asdf\\\\quux'                                     0.09 %       ±5.54%  ±7.38%  ±9.62%
path/extname-win32.js n=100000 path='foo\\\\.bar.baz'                                                            -1.35 %       ±4.60%  ±6.13%  ±7.97%
path/extname-win32.js n=100000 path='\\\\foo\\\\bar\\\\baz\\\\asdf\\\\quux.foobarbazasdfquux'                    -0.51 %       ±4.66%  ±6.21%  ±8.09%
path/extname-win32.js n=100000 path='foo\\\\bar\\\\...baz.quux'                                                  -3.03 %       ±5.36%  ±7.14%  ±9.32%
path/extname-win32.js n=100000 path='foo\\\\bar\\\\..baz.quux'                                                   -2.54 %       ±4.79%  ±6.38%  ±8.32%
path/extname-win32.js n=100000 path='index'                                                                      -3.92 %       ±5.81%  ±7.78% ±10.21%
path/extname-win32.js n=100000 path='index.html'                                                                 -1.52 %       ±5.68%  ±7.56%  ±9.85%
path/format-posix.js n=1000000 props='/|/home/user/dir|index.html|.html|index'                                   -2.63 %       ±3.16%  ±4.20%  ±5.47%
path/format-win32.js n=1000000 props='C:\\\\|C:\\\\path\\\\dir|index.html|.html|index'                           -0.07 %       ±3.12%  ±4.15%  ±5.40%
path/isAbsolute-posix.js n=100000 path='.'                                                                        1.62 %       ±3.87%  ±5.15%  ±6.70%
path/isAbsolute-posix.js n=100000 path=''                                                                        -3.17 %       ±4.47%  ±5.95%  ±7.76%
path/isAbsolute-posix.js n=100000 path='bar/baz'                                                                  0.84 %       ±4.28%  ±5.70%  ±7.41%
path/isAbsolute-posix.js n=100000 path='/baz/..'                                                                  1.50 %       ±3.64%  ±4.85%  ±6.33%
path/isAbsolute-posix.js n=100000 path='/foo/bar'                                                                 2.41 %       ±4.56%  ±6.10%  ±7.98%
path/isAbsolute-win32.js n=100000 path='.'                                                                       -1.17 %       ±5.15%  ±6.86%  ±8.93%
path/isAbsolute-win32.js n=100000 path=''                                                                        -0.79 %       ±5.38%  ±7.16%  ±9.32%
path/isAbsolute-win32.js n=100000 path='bar\\\\baz'                                                               1.20 %       ±5.05%  ±6.73%  ±8.77%
path/isAbsolute-win32.js n=100000 path='C:\\\\baz\\\\..'                                                         -1.84 %       ±3.78%  ±5.03%  ±6.55%
path/isAbsolute-win32.js n=100000 path='C:baz\\\\..'                                                              1.50 %       ±4.41%  ±5.88%  ±7.67%
path/isAbsolute-win32.js n=100000 path='//server'                                                                 0.08 %       ±4.39%  ±5.85%  ±7.61%
path/join-posix.js n=100000 paths='/foo|bar||baz/asdf|quux|..'                                                   -2.34 %       ±3.25%  ±4.33%  ±5.63%
path/join-win32.js n=100000 paths='C:\\\\foo|bar||baz\\\\asdf|quux|..'                                           -1.95 %       ±5.02%  ±6.68%  ±8.70%
path/makeLong-win32.js n=100000 path='C:\\\\foo'                                                                 -2.30 %       ±5.22%  ±6.96%  ±9.08%
path/makeLong-win32.js n=100000 path='\\\\\\\\?\\\\foo'                                                          -2.96 %       ±5.72%  ±7.61%  ±9.91%
path/makeLong-win32.js n=100000 path='\\\\\\\\foo\\\\bar'                                                        -2.88 %       ±5.32%  ±7.08%  ±9.23%
path/makeLong-win32.js n=100000 path='foo\\\\bar'                                                                 2.05 %       ±5.24%  ±6.98%  ±9.08%
path/normalize-posix.js n=100000 path='/../'                                                                      0.28 %       ±5.77%  ±7.68% ±10.01%
path/normalize-posix.js n=100000 path='.'                                                                        -0.56 %       ±5.31%  ±7.06%  ±9.19%
path/normalize-posix.js n=100000 path=''                                                                         -3.20 %       ±4.05%  ±5.39%  ±7.03%
path/normalize-posix.js n=100000 path='/foo'                                                                     -1.97 %       ±4.85%  ±6.46%  ±8.41%
path/normalize-posix.js n=100000 path='/foo/bar'                                                                 -0.94 %       ±4.64%  ±6.17%  ±8.03%
path/normalize-posix.js n=100000 path='/foo/bar//baz/asdf/quux/..'                                               -1.33 %       ±5.59%  ±7.44%  ±9.70%
path/normalize-win32.js n=100000 path='.'                                                                        -1.66 %       ±4.58%  ±6.11%  ±8.00%
path/normalize-win32.js n=100000 path=''                                                                         -0.98 %       ±4.23%  ±5.62%  ±7.32%
path/normalize-win32.js n=100000 path='C:\\\\..\\\\'                                                              2.14 %       ±4.55%  ±6.06%  ±7.90%
path/normalize-win32.js n=100000 path='C:\\\\foo'                                                         **     -5.72 %       ±3.58%  ±4.77%  ±6.21%
path/normalize-win32.js n=100000 path='C:\\\\foo\\\\bar'                                                          1.62 %       ±4.87%  ±6.49%  ±8.45%
path/normalize-win32.js n=100000 path='C:\\\\foo\\\\bar\\\\\\\\baz\\\\asdf\\\\quux\\\\..'                        -1.99 %       ±4.96%  ±6.60%  ±8.60%
path/parse-posix.js n=100000 path='/'                                                                            -4.01 %       ±5.83%  ±7.77% ±10.13%
path/parse-posix.js n=100000 path=''                                                                             -2.35 %       ±4.42%  ±5.88%  ±7.66%
path/parse-posix.js n=100000 path='/foo'                                                                         -3.23 %       ±6.89%  ±9.20% ±12.03%
path/parse-posix.js n=100000 path='foo/bar'                                                                      -0.42 %       ±5.82%  ±7.75% ±10.09%
path/parse-posix.js n=100000 path='/foo/bar.baz'                                                                  0.81 %       ±5.49%  ±7.30%  ±9.51%
path/parse-posix.js n=100000 path='foo/.bar.baz'                                                                 -0.65 %       ±5.61%  ±7.46%  ±9.72%
path/parse-posix.js n=100000 path='/foo/bar/baz/asdf/.quux'                                                       0.27 %       ±6.22%  ±8.27% ±10.77%
path/parse-win32.js n=100000 path=''                                                                              2.56 %       ±7.50%  ±9.99% ±13.04%
path/parse-win32.js n=100000 path='C:\\\\'                                                                       -3.24 %       ±7.88% ±10.48% ±13.64%
path/parse-win32.js n=100000 path='C:\\\\foo'                                                                    -4.98 %       ±7.87% ±10.49% ±13.70%
path/parse-win32.js n=100000 path='E:\\\\foo\\\\bar.baz'                                                         -4.33 %       ±6.88%  ±9.16% ±11.92%
path/parse-win32.js n=100000 path='\\\\foo'                                                                       0.46 %       ±7.64% ±10.16% ±13.24%
path/parse-win32.js n=100000 path='foo\\\\bar'                                                                   -3.65 %       ±7.37%  ±9.81% ±12.77%
path/parse-win32.js n=100000 path='foo\\\\.bar.baz'                                                              -2.86 %       ±6.83%  ±9.09% ±11.83%
path/parse-win32.js n=100000 path='\\\\foo\\\\bar\\\\baz\\\\asdf\\\\.quux'                                       -7.07 %       ±8.19% ±10.91% ±14.22%
path/relative-posix.js n=100000 paths='/|/'                                                                      -0.45 %       ±5.70%  ±7.58%  ±9.87%
path/relative-posix.js n=100000 paths='/data/orandea/test/aaa|/data/orandea/impl/bbb'                             3.38 %       ±3.55%  ±4.73%  ±6.15%
path/relative-posix.js n=100000 paths='/foo/bar/baz/quux|/'                                                      -0.43 %       ±3.93%  ±5.23%  ±6.81%
path/relative-posix.js n=100000 paths='/foo/bar/baz/quux|/foo/bar/baz/quux'                                       0.87 %       ±5.52%  ±7.36%  ±9.60%
path/relative-posix.js n=100000 paths='/foo/bar/baz/quux|/var/log'                                               -4.19 %       ±4.20%  ±5.60%  ±7.29%
path/relative-posix.js n=100000 paths='/|/var'                                                                   -0.96 %       ±4.23%  ±5.64%  ±7.36%
path/relative-posix.js n=100000 paths='/var|/bin'                                                                 2.77 %       ±5.05%  ±6.73%  ±8.77%
path/relative-win32.js n=100000 paths='C:\\\\|D:\\\\'                                                             1.34 %       ±3.75%  ±4.98%  ±6.49%
path/relative-win32.js n=100000 paths='C:\\\\foo\\\\bar\\\\baz|C:\\\\foo\\\\bar\\\\baz'                   **     -7.12 %       ±5.20%  ±6.94%  ±9.07%
path/relative-win32.js n=100000 paths='C:\\\\foo\\\\BAR\\\\BAZ|C:\\\\foo\\\\bar\\\\baz'                          -0.01 %       ±4.97%  ±6.61%  ±8.61%
path/relative-win32.js n=100000 paths='C:\\\\foo\\\\bar\\\\baz\\\\quux|C:\\\\'                                    1.36 %       ±3.22%  ±4.29%  ±5.59%
path/relative-win32.js n=100000 paths='C:\\\\orandea\\\\test\\\\aaa|C:\\\\orandea\\\\impl\\\\bbb'                 2.98 %       ±3.82%  ±5.09%  ±6.65%
path/resolve-posix.js n=100000 paths='|'                                                                          0.75 %       ±5.52%  ±7.35%  ±9.57%
path/resolve-posix.js n=100000 paths=''                                                                    *     -8.80 %       ±7.96% ±10.64% ±13.95%
path/resolve-posix.js n=100000 paths='a/b/c/|../../..'                                                            2.52 %       ±5.25%  ±6.99%  ±9.10%
path/resolve-posix.js n=100000 paths='foo/bar|/tmp/file/|..|a/../subfile'                                        -4.11 %       ±4.96%  ±6.61%  ±8.61%
path/resolve-win32.js n=100000 paths='|'                                                                          2.82 %       ±5.85%  ±7.78% ±10.14%
path/resolve-win32.js n=100000 paths=''                                                                          -4.18 %       ±6.05%  ±8.06% ±10.49%
path/resolve-win32.js n=100000 paths='c:/blah\\\\blah|d:/games|c:../a'                                           -1.68 %       ±4.20%  ±5.59%  ±7.28%
path/resolve-win32.js n=100000 paths='c:/ignore|d:\\\\a/b\\\\c/d|\\\\e.exe'                                       0.19 %       ±5.64%  ±7.51%  ±9.78%

Be aware that when doing many comparisons the risk of a false-positive
result increases. In this case there are 120 comparisons, you can thus
expect the following amount of false-positive results:
 6.00 false positives, when considering a   5% risk acceptance (*, **, ***),
 1.20 false positives, when considering a   1% risk acceptance (**, ***),
 0.12 false positives, when considering a 0.1% risk acceptance (***)

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Nov 30, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 30, 2020
@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 2, 2020
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 2, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2020

Landed in 325a1fc...187a862

@github-actions github-actions bot closed this Dec 2, 2020
nodejs-github-bot pushed a commit that referenced this pull request Dec 2, 2020
PR-URL: #36302
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@aduh95 aduh95 deleted the path-primordials branch December 2, 2020 20:23
danielleadams pushed a commit that referenced this pull request Dec 7, 2020
PR-URL: #36302
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request Dec 7, 2020
cjihrig pushed a commit to cjihrig/node that referenced this pull request Dec 8, 2020
PR-URL: nodejs#36302
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request May 16, 2021
PR-URL: #36302
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request Jun 11, 2021
PR-URL: #36302
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. path Issues and PRs related to the path subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants