How Fast Bun Installs Packages ?

To see how fast bun installs packages compared to nodejs, I created a small project that has only 5 dependencies.

  1. a-fetch
  2. a-signal
  3. ajv
  4. aws-sdk
  5. axios

I will use the code below to measure how much time is spend installing the packages in milliseconds

echo $(($(date +%s%N)/1000000))
npm i
echo $(($(date +%s%N)/1000000))

npm

1675297466099 - 1675297464841 = 1258. There is a 1258 milliseconds difference so that's 1.25 seconds.

Let's try it now with bun

echo $(($(date +%s%N)/1000000))
bun i
echo $(($(date +%s%N)/1000000))

npm 1675297678954 - 1675297678910 = 44. There is only 44 milliseconds difference and 3ms of that is because of the timestamp command.

1258/44 = 28.59. Bun was 28.5 times faster.

But that's just for 5 dependencies, what if I had 100 dependencies ?

Trying with more dependencies

Let's see. I installed most 100 depended packages from here to my demo project and we will compare the time again.

With npm:

1675299832241 - 1675299655932=176309 = 176,309 seconds = 2.93 minutes.

With bun:

1675299944684 - 1675299939218 = 5.4 seconds...

This time bun was 35 times faster

So bun can be even faster when it comes to installing packages for bigger projects.

If you want to share my content, please use the buttons below. Thank you! © Ali Gümüş TosunRSS