JavaScript包管理器的基准测试

pnpm 官方维护的一份包管理器基准测试。
该基准测试比较了npmpnpmYarn ClassicYarn PnP的性能(请查看Yarn的基准测试,以获取此处未包含的其他Yarn模式)。

以下是这些测试如何应用的简要解释:

  • clean install:运行完全新的安装所需的时间:没有lock文件存在,缓存中没有软件包,没有node_modules文件夹。
  • with cache, with lockfile, with node_modules:第一次安装完成后再次运行安装命令。
  • with cache, with lockfile:当开发者获取一个存储库并首次运行安装时。
  • with cache:与上述相同,但包管理器没有lock文件可用。
  • with lockfile:当在CI服务器上运行安装时。
  • with cache, with node_modules:删除锁定文件,然后再次运行安装命令。
  • with node_modules, with lockfile:删除软件包缓存,然后再次运行安装命令。
  • with node_modules:删除软件包缓存和锁定文件,然后再次运行安装命令。
  • update:通过更改package.json中的版本并再次运行安装命令来更新您的依赖项。

    验证测试结果

    package.json文件
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    {
    "name": "alotta-modules",
    "version": "0.0.1",
    "dependencies": {
    "animate.less": "^2.2.0",
    "autoprefixer": "^10.4.17",
    "babel-core": "^6.26.3",
    "babel-eslint": "^10.1.0",
    "babel-loader": "^9.1.3",
    "babel-plugin-lodash": "^3.3.4",
    "babel-plugin-module-resolver": "^5.0.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-react-hmre": "^1.1.1",
    "babel-preset-stage-1": "^6.24.1",
    "babel-runtime": "^6.26.0",
    "clean-webpack-plugin": "^4.0.0",
    "core-decorators": "^0.20.0",
    "css-loader": "^6.9.0",
    "css-mqpacker": "^7.0.0",
    "cssnano": "^6.0.3",
    "custom-event-polyfill": "^1.0.7",
    "draft-js": "^0.11.7",
    "ejs": "^3.1.9",
    "eslint": "^8.56.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-import-resolver-webpack": "^0.13.8",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-jsx-a11y": "^6.8.0",
    "eslint-plugin-react": "^7.33.2",
    "express": "^4.18.2",
    "express-http-proxy": "^2.0.0",
    "font-awesome": "^4.7.0",
    "fready": "^1.0.0",
    "glob": "^10.3.10",
    "gulp": "^4.0.2",
    "gulp-concat": "^2.6.1",
    "gulp-csslint": "^1.0.1",
    "gulp-cssnano": "^2.1.3",
    "gulp-eol": "^0.2.0",
    "gulp-less": "^5.0.0",
    "gulp-livereload": "^4.0.2",
    "gulp-minify-css": "^1.2.4",
    "gulp-postcss": "^9.1.0",
    "gulp-rename": "^2.0.0",
    "gulp-util": "^3.0.8",
    "happypack": "^5.0.1",
    "highcharts": "^11.3.0",
    "highcharts-solid-gauge": "^0.1.7",
    "history": "^5.3.0",
    "howler": "^2.2.4",
    "imports-loader": "^5.0.0",
    "jquery": "^3.7.1",
    "jquery-ui": "1.13.2",
    "js-cookie": "^3.0.5",
    "json-loader": "^0.5.7",
    "leftpad": "^0.0.1",
    "less": "^4.2.0",
    "lesshat": "^4.1.0",
    "lodash": "^4.17.21",
    "medium-draft": "^0.5.18",
    "mobx": "^6.12.0",
    "mobx-react": "^9.1.0",
    "moment": "^2.30.1",
    "moment-range": "^4.0.2",
    "moment-timezone": "^0.5.44",
    "password-policy": "0.0.3",
    "postcss-reporter": "^7.1.0",
    "progress": "^2.0.3",
    "qs": "^6.11.2",
    "raw-loader": "^4.0.2",
    "rc-slider": "^10.5.0",
    "react": "^18.2.0",
    "react-addons-css-transition-group": "^15.6.2",
    "react-addons-shallow-compare": "^15.6.3",
    "react-dnd": "^16.0.1",
    "react-dnd-html5-backend": "^16.0.1",
    "react-dom": "^18.2.0",
    "react-draft-wysiwyg": "^1.15.0",
    "react-dropzone": "^14.2.3",
    "react-grid-layout": "^1.4.4",
    "react-highcharts": "^16.1.0",
    "react-hot-loader": "4.13.1",
    "react-input-calendar": "^0.5.4",
    "react-lazyload": "^3.2.0",
    "react-measure": "^2.5.2",
    "react-mixin": "^5.0.0",
    "react-responsive": "9.0.2",
    "react-responsive-tabs": "^4.4.3",
    "react-router": "^6.21.2",
    "react-router-dom": "^6.21.2",
    "react-select-plus": "1.0.0-rc.3.patch12",
    "react-skylight": "^0.5.1",
    "react-sortablejs": "^6.1.4",
    "react-tappable": "^1.0.4",
    "react-tooltip": "5.25.2",
    "react-virtualized": "^9.22.5",
    "react-waypoint": "^10.3.0",
    "sortablejs": "^1.15.2",
    "style-loader": "^3.3.4",
    "stylelint": "^16.1.0",
    "superagent": "^8.1.2",
    "uglify-js": "^3.17.4",
    "uuid": "^9.0.1",
    "verge": "^1.10.2",
    "webpack-bundle-analyzer": "^4.10.1",
    "webpack-hot-middleware": "^2.26.0",
    "webpack-notifier": "^1.15.0",
    "webpack-split-by-path": "^2.0.0",
    "whatwg-fetch": "^3.6.20"
    },
    "devDependencies": {
    "nan-as": "^1.6.1"
    }
    }
    action cache lockfile node_modules npm pnpm Yarn Yarn PnP
    install 35.6s 9s 7.4s 3.7s
    install 1.5s 1.1s 4.9s n/a
    install 7.2s 2.7s 5.4s 1.4s
    install 12.8s 6.2s 7.7s 3.1s
    install 12.3s 5.4s 5.4s 1.4s
    install 1.7s 2.4s 7.1s n/a
    install 1.5s 1.1s 4.9s n/a
    install 1.7s 5.4s 7s n/a
    update n/a n/a n/a 8.1s 4s 5.7s 3.1s