Speed test building Next.js T3 App with Github Actions, Circle CI, Vercel & Diginext
Tags: diginext, performance, webdev, opensource
Published: 2023-07-03 06:14:20

Since when I [started building](https://dev.to/mrgoonie/i-turn-my-companys-pc-into-my-own-vercel-like-platform-351o) my own open-source cloud resouce platform - [Diginext](https://github.com/digitopvn/diginext/), although I had never done a benchmark, I kept thinking that I had built it for personal purposes only, to serve my teams and enhance their daily workflow. However, I must admit that I was not confident until today, the tests were supprising myself.

![whatever it takes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0smmbshizeqyoxnb5527.png)

*(*) If you wanna check if I made incorrect configurations, here is the source code: https://github.com/digitopvn/t3-app-starter*

### **Now, let’s get the party started!**

## First time, with no cache:

### 1. Docker Engine on my Macbook M1 Pro

Took **4 mins and 33 secs** (~273 seconds)

![docker build speed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6lthkxbuhqia0y1yedhf.png)

(with `docker system prune` and `docker volume prune` excecuted before running `docker buildx`)

### 2. Github Actions

Finished in **3m 56s**

![Github Actions docker build](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07ju14tmp2x3sl6daegu.png)

### 3. Circle CI

They said they are nearly [2x faster than Github Actions](https://circleci.com/circleci-versus-github-actions/), let’s see…

Huh?… **5m 48s**

![CircleCI Docker Build Speed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y9tum152v4h5lb25hbh9.png)

…not like the advertisement.

- [This](https://github.com/digitopvn/t3-app-starter/blob/circleci-project-setup/.circleci/config.yml) is the `.circleci/config.yml`
    
    ```yaml
    version: 2.1
    
    jobs:
      build-and-push:
        docker:
          - image: cimg/base:stable
        steps:
          - setup_remote_docker:
              version: 20.10.11
              docker_layer_caching: true
          - checkout
          - run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
          - run: docker buildx build --push -t digitop/t3-app-starter:circleci-v1 .
    
    workflows:
      version: 2
      docker-build-push:
        jobs:
          - build-and-push
    ```

### 4. Diginext

Not so bad… **3m 11s**! (even faster than my macbook)

![Diginext app build speed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d554c5vw52i6ooe279ep.png)

Triggered by `dx build` command.

### 5. Vercel

Is the winner with… **1m 3s** (incredible!)

![Vercel app build speed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3x4h9kbqu7r6maelwbcg.png)

I guess because **Vercel** platform doesn’t have to spin up a Docker container, they just built the Next.js app natively, that’s why it didn’t take a lot of time for Docker cold start.

#### **Alright, let’s do another round!**

## Second build, cached!

Notes that I changed nothing, just built them again.

### 1. My macbook M1 Pro

Great! when the cache hit, it only took **39 seconds**

![Docker build speed with cache](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qd9e8a7ch45w84xfaf5f.png)

### 2. Github Actions

Wait… **4m 10s** ?

*(WTF? it’s even slower than the first run?)*

![Github Actions Docker build speed with cache](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46tqkpv55fv628vb1msk.png)

I followed this guide: https://docs.docker.com/build/ci/github-actions/cache/

I tried again a few time but sometime it was fast (~1min), sometime it was not (>3mins). It seems like the cache didn’t work or the workflows are just not stable. Not sure why.

![Github Actions Docker build speed with cache multiple tries](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ceidjih87lmcfu1k1p1h.png)

### 3. Circle CI

Well, about **2x faster** than the first run, completed in **2m 40s**

![Circle CI Docker build speed with cache](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xep7er1dkl0aaccfog0g.png)

### 5. Vercel

Again, very impressive: **38 seconds** (~40% faster than the first run)

![Vercel app build speed with cache](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qp6wubzv814n0937bng.png)

### 4. Diginext

Woohoo… **21 seconds**! When the cache hit, Diginext is the winner with **~90% faster** than the first run.

![Diginext app build with cache](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w96n41v38wfcg8u8ny6q.png)

This is so surprising… even with me, its creator.

## Summary

**GitHub Actions** and **Circle CI** were originally designed for purposes other than building apps. Considering their primary functions, it's understandable that the current build speed is deemed acceptable.

On the other hand, the immensely popular Vercel is gaining significant traction. As a frontend cloud platform, it supports a wide range of the [most popular frontend frameworks](https://vercel.com/docs/frameworks), and there's a good chance they will expand their support to include backend frameworks in the future.

In contrast, [Diginext](https://github.com/digitopvn/diginext/) is an open-source cloud platform that caters to any types of applications. Its philosophy is encapsulated in the motto, ***“if it can run on your computer, it can run on Diginext”***, and the platform's mission revolves around ***“making coding great again”*** by simplifying app deployment and cloud resource management.

I appreciate the boost in my confidence as these tests have helped me reconsider the value of [Diginext](https://github.com/digitopvn/diginext/). While it may be deemed unacceptable to compare it directly with renowned platforms like Vercel, it's encouraging to think that if it proves beneficial for my teams, it could potentially benefit the wider developer community as well.

> **<u>Update:</u>** As I pen this article, I observe that [Render](https://render.com/) and [Railway](https://railway.app/) are currently making strides towards the same objectives as Diginext. Witnessing their well-established services and robust financial backing does dampen my spirits slightly. However, I refuse to give up. I firmly believe that with the advantages of an open-source platform, [Diginext](https://github.com/digitopvn/diginext/) can deliver value to the developer community, particularly to those of us who are [financially challenged— much like myself](https://dev.to/mrgoonie/kubernetes-for-the-poor-2ne), haha.

![I will keep fighting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofqohnv2ie42qeggg42q.png)