yarn ci_因此,我将Yarn与4种最受欢迎​​的CI工具进行了基准测试。

yarn ci

by Alberto Varela

阿尔贝托·瓦雷拉(Alberto Varela)

Yarn is a recently launched alternative for npm as Node.js dependency manager. It claims to be much faster and reliable than its predecessor. Let see if it’s true.

Yarn是npm最近发布的替代品,它是Node.js依赖项管理器。 它声称比以前的产品更快,更可靠。 让我们看看这是真的。

If you’re a Javascript developer — and especially if you work with Node.js — you’ve probably heard some buzz around Yarn in the past few days. Engineers from Facebook Exponent, Google, and Tilde have been working together to build this alternative for the well known npm, the built-in package manager of Node.js.

如果您是Java语言开发人员,尤其是如果您使用Node.js,那么过去几天您可能已经听到有关Yarn的一些嗡嗡声。 来自Facebook Exponent,Google和Tilde的工程师一直在共同努力 为著名的Node.js内置软件包管理器npm 构建此替代方案。

Over the last few years, developers around the world have started to complain about how slow npm is. The other thing they want is a dependency system that’s able to avoid inconsistencies between environments. So Yarn bills itself as exactly what we’ve wanted all along: “Fast, Reliable, and Secure Dependency Management.”

在过去的几年中,世界各地的开发人员开始抱怨npm的运行速度很慢。 他们想要的另一件事是一个依赖系统,它能够避免环境之间的不一致。 因此,Yarn完全按照我们一直想要的方式计费:“快速,可靠和安全的依赖性管理”。

It’s clear that the introduction of the yarn.lock file and the checksum verification adds consistency and integrity to our packages between environments, but… what about speed? Yarn claims that it’s ultra fast. So I set to work benchmarking it against npm in a variety of environments.

显然, yarn.lock文件的引入和校验和验证为环境之间的程序包增加了一致性和完整性,但是……速度又如何呢? Yarn 声称它非常快 。 因此,我准备在各种环境中针对npm对其进行基准测试。

方法 (The Method)

The tool I’ve used to measure the speed of both package managers is the humble Linux command time. I wrote a little Bash script — based on this gist made by Peter Mitchell.

我用来衡量两个软件包管理器速度的工具是不起眼的Linux命令time 。 我根据Peter Mitchell提出的要点写了一个Bash脚本。

The script runs multiple installations for Angular, Ember, and React using both npm and Yarn. It measures the amount of time each installation takes. Then, at the end, it displays the average metrics, sorted by package manager and framework. It will also perform installations with pre-cached packages and with empty cache to see the difference between both situations.

该脚本使用npm和Yarn运行AngularEmberReact的多个安装。 它测量每次安装所花费的时间。 然后,最后显示平均度量,按程序包管理器和框架排序。 它还将使用预缓存的程序包和空缓存执行安装,以查看两种情况之间的差异。

You can see the script used here: https://github.com/artberri/npm-yarn-benchmark

您可以在此处查看使用的脚本: https : //github.com/artberri/npm-yarn-benchmark

环境 (The Environment)

Once I’d chosen the benchmarking tool, it was time to run the script.

一旦选择了基准测试工具,就该运行脚本了。

I started by running it on my own computer. Then, In order to achieve more standard metrics, I ran the script again using the following Continuous Integration (CI) tools: Travis, Snap CI, Semaphore, and Circle CI.

我首先在自己的计算机上运行它。 然后,为了获得更多标准指标,我使用以下持续集成(CI)工具再次运行了脚本:Travis,Snap CI,Semaphore和Circle CI。

Because of the large amount of installing that’s done during each test run, the script took a while to finish. In order to avoid timeouts in these CI tools, I calculated the timing averages will be calculated over three runs.

由于每次测试运行期间都要进行大量安装,因此该脚本花了一些时间才能完成。 为了避免这些CI工具中的超时,我计算了将在三个运行中计算的平均时间。

结果 (The Results)

In my own computer:

在我自己的计算机上:

---------------------------------------------------------------------------------------------- RESULTS (seconds) -------------------------------------------------------------------------------------------|                       |     angular2 |        ember |        react |  npm_with_empty_cache |       15.687 |       56.993 |       93.650 |   npm_with_all_cached |        9.380 |       52.380 |       81.213 | yarn_with_empty_cache |        9.477 |       30.757 |       37.497 |  yarn_with_all_cached |        4.650 |       15.090 |       17.730 --------------------------------------------------------------------

In Travis:

特拉维斯(Travis)

------------------------------------------------------------------------------------------- RESULTS (seconds) ----------------------------------------------------------------------------------------------|                      |     angular2 |        ember |        react | npm_with_empty_cache |       19.720 |       55.090 |       76.233 |  npm_with_all_cached |       14.640 |       40.203 |       56.467 |yarn_with_empty_cache |       13.193 |       34.037 |       43.663 | yarn_with_all_cached |        5.830 |       15.923 |       40.420 --------------------------------------------------------------------

In Snap CI:

Snap CI中

--------------------------------------------------------------------------------------------- RESULTS (seconds) --------------------------------------------------------------------------------------------|                      |     angular2 |        ember |        react | npm_with_empty_cache |       20.640 |       57.030 |      120.470 |  npm_with_all_cached |       15.753 |       45.273 |       62.597 |yarn_with_empty_cache |       12.227 |       41.997 |       51.863 | yarn_with_all_cached |        7.693 |       23.607 |       24.490 --------------------------------------------------------------------

In Semaphore:

信号量中

------------------------------------------------------------------------------------------- RESULTS (seconds) ----------------------------------------------------------------------------------------------|                      |     angular2 |        ember |        react | npm_with_empty_cache |       11.057 |       35.287 |       54.203 |  npm_with_all_cached |        7.107 |       24.797 |       31.300 |yarn_with_empty_cache |        6.273 |       17.407 |       22.777 | yarn_with_all_cached |        2.790 |        8.150 |        9.380 --------------------------------------------------------------------

In CircleCI:

CircleCI中

------------------------------------------------------------------------------------------- RESULTS (seconds) ----------------------------------------------------------------------------------------------|                      |     angular2 |        ember |        react | npm_with_empty_cache |       42.940 |      100.287 |      163.550 |  npm_with_all_cached |       16.990 |       50.083 |       67.000 |yarn_with_empty_cache |       15.907 |       45.547 |       58.113 | yarn_with_all_cached |        7.547 |       26.763 |       27.130 --------------------------------------------------------------------

结论 (The Conclusion)

Yarn is Ultra Fast, between 2 and 3 times faster than npm.

纱线超快,比npm快2至3倍。

The Yarn creators are telling the truth. It’s awesome to see that Yarn is faster, even when we compare the npm cached test with an un-cached Yarn test.

纱线的创造者在说实话。 即使我们比较npm缓存的测试和未缓存的Yarn测试,也能看到Yarn更快,这真是太棒了。

Based on this, I’d say that Yarn is poised to become the standard dependency manager for Node.js within just a few months.

基于此,我想说Yarn准备在短短几个月内成为Node.js的标准依赖项管理器。

On a side note, the aim of this comparison was not to benchmark CI tools, but it’s worth mentioning that Semaphore performed favorably compared with the rest of tools I used in this example.

附带说明一下,此比较的目的不是要对CI工具进行基准测试,但是值得一提的是,与本示例中使用的其余工具相比,Semaphore的表现令人满意。

I’ve been testing Yarn since day one, and this is something I’ve wanted for a long time.

从第一天开始我就一直在测试Yarn,这是我长期以来一直想要的。

I’m currently using Puppet for software provisioning in most of my projects. Because of this, I’ve created a Puppet module for installing Yarn that you can try out here.

我目前在大多数项目中都使用Puppet进行软件配置。 因此,我创建了一个用于安装Yarn的Puppet模块,您可以在此处试用

Thanks for reading, and happy installing!

感谢您的阅读,并祝您安装愉快!

Originally published at www.berriart.com.

最初在www.berriart.com上发布。

翻译自: https://www.freecodecamp.org/news/npm-vs-yarn-benchmark-9b456de4aa96/

yarn ci

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值