<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: jalelagrebi</title>
    <description>The latest articles on Forem by jalelagrebi (@jaleleddineagrebi).</description>
    <link>https://forem.com/jaleleddineagrebi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F238306%2F2eae8b28-9fee-4ae3-9ba2-16e82de09b79.png</url>
      <title>Forem: jalelagrebi</title>
      <link>https://forem.com/jaleleddineagrebi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jaleleddineagrebi"/>
    <language>en</language>
    <item>
      <title>Bun faster than node .</title>
      <dc:creator>jalelagrebi</dc:creator>
      <pubDate>Mon, 29 Dec 2025 14:05:20 +0000</pubDate>
      <link>https://forem.com/jaleleddineagrebi/bun-faster-then-node--54c4</link>
      <guid>https://forem.com/jaleleddineagrebi/bun-faster-then-node--54c4</guid>
      <description>&lt;p&gt;I’m comparing server-side rendering (SSR) for an Angular application using two JavaScript runtimes — Node.js and Bun — to evaluate performance. This test will deploy the same Angular SSR build in both environments, measure cold and warm startup times, request throughput and latency under load, memory usage. The goal is to determine whether Bun’s performance-oriented design and built-in tooling offer meaningful advantages over the established Node.js ecosystem for Angular SSR.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Node&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;let's create new angular 19 project with npm (node v24) (ssr)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ng new testangularbun&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and follow instruction ....&lt;/p&gt;

&lt;p&gt;hit &lt;code&gt;npm i&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then &lt;code&gt;npm run build&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;last &lt;code&gt;serve:ssr:testangularbun&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Browse &lt;em&gt;&lt;a href="http://localhost:4200/" rel="noopener noreferrer"&gt;http://localhost:4200/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;you should se the beautifull angular page :)&lt;/p&gt;

&lt;p&gt;now comming to the interresting part &lt;/p&gt;

&lt;p&gt;in the root of the project &lt;br&gt;
create new Docker file with the following content &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0oclg6h6ylz3kk7q6pgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0oclg6h6ylz3kk7q6pgb.png" alt=" " width="477" height="184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;docker build -f Dockerfile . -t testnode&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
once done you should see this in Docker desktop &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn07hqf09mjsz6d34exh9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn07hqf09mjsz6d34exh9.png" alt=" " width="800" height="37"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;blockquote&gt;
&lt;p&gt;Bun &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;let's start by insalling Bun v 1.3.5 &lt;br&gt;
you can follow this &lt;a href="https://bun.com/docs" rel="noopener noreferrer"&gt;https://bun.com/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;**&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsSL https://bun.com/install | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
**&lt;br&gt;
you can test it after restarting you terminal by typing bun --version &lt;/p&gt;

&lt;p&gt;one small thing to change is your docker file &lt;br&gt;
here is the new file &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3xek5q2o9rco4i4wcfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3xek5q2o9rco4i4wcfy.png" alt=" " width="597" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;then hit &lt;br&gt;
&lt;code&gt;docker build -f Dockerfile .&lt;/code&gt;&lt;br&gt;
now you will see the new Docker image running with bun ! amazing xD&lt;/p&gt;

&lt;p&gt;_*&lt;em&gt;Last step *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;let's load test the two running images ...&lt;br&gt;
install &lt;em&gt;autocannon&lt;/em&gt; &lt;br&gt;
here -&amp;gt; &lt;a href="https://formulae.brew.sh/formula/autocannon" rel="noopener noreferrer"&gt;https://formulae.brew.sh/formula/autocannon&lt;/a&gt;&lt;br&gt;
in your terminal hit &lt;br&gt;
&lt;code&gt;$ autocannon -c 100 -d 10 http://localhost:4200&lt;br&gt;
&lt;/code&gt;_&lt;/p&gt;

&lt;p&gt;here is the result's &lt;br&gt;
&lt;em&gt;node&lt;/em&gt; : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcf3lxug7fj7wc5yq4552.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcf3lxug7fj7wc5yq4552.png" alt=" " width="633" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;bun&lt;/em&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdh3bymd2biamk0s2v74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdh3bymd2biamk0s2v74.png" alt=" " width="637" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt; : &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Bun demonstrated consistently faster performance than Node.js for this Angular SSR workload. Bun’s optimized JavaScript engine and native-built tooling produced quicker cold starts and higher requests-per-second in our tests, while using comparable or lower memory. Although some minor compatibility adjustments were required for certain Node-specific modules, they did not offset the overall runtime gains. Therefore, for this Angular SSR project, Bun is the faster runtime and a compelling choice when raw request performance and startup speed are priorities; projects with deep Node-native dependencies should still evaluate compatibility before migrating.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>node</category>
      <category>angular</category>
      <category>ssr</category>
      <category>bunjs</category>
    </item>
  </channel>
</rss>
