Skip to content

Unzipping is 50x times slower in NextJS compared to Gatsby or other platform #22372

@ingun37

Description

@ingun37

What version of Next.js are you using?

10.0.5

What version of Node.js are you using?

12.0.0

What browser are you using?

Safari, Chrome

What operating system are you using?

macOS, Windows

How are you deploying your application?

next start

Describe the Bug

Unzipping a zip file using JSZip is 50x slower in NextJS than in Gatsby.
I made a sample app that unzips a zip file on both NextJS and Gatsby. It took for 162647.844ms for NextJS while it only took for 3091.979ms in Gatsby.

I believe it's not only unzipping but execution of javascript (especially cjs modules) is generally slow in NextJS. The whole reason I've done it in the first place was because my js library was significantly slow only when it was used on NextJS app. Unzipping is just the most extreme case that I've observed. My library, which is primarily WebGL, becomes about 2~10x slower (depending on the kind of job) in NextJS compared to Gatsby or other platforms.

Expected Behavior

I expect no runtime performance difference to Gatsby.

To Reproduce

Here's the sample app
https://github.com/ingun37/nextjs-bug-reproduce-sample

NextJS

  • location: /nextjs
  • How to run
    1. yarn run dev or yarn run build && yarn run start
    2. Click Unzip and measure the time button and check the console.

Gatsby

  • location: /gatsby
  • How to run
    1. npm i && npm run develop
    2. Click Unzip and measure the time button and check the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions