vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.92k stars 26.98k forks source link

Next build perf issue with long string `.concat` function #65512

Open zombieJ opened 6 months ago

zombieJ commented 6 months ago

Link to the code that reproduces this issue

https://github.com/ant-design/ant-design/issues/48758

To Reproduce

Hi, I'm the member of antd team. Recently get report with build perf issue of Next.js:

https://github.com/ant-design/ant-design/issues/48758

After dig, found that Next.js has the perf issue with long string .concat function. Pls help to check on this. Here is the workaround PR on antd side:

https://github.com/react-component/async-validator/pull/9

The research report (PR background part):

https://github.com/ant-design/ant-design/pull/48829

Current vs. Expected behavior

Generating static file as fast as expected.

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 18.19.1
  npm: 10.2.4
  Yarn: 1.22.21
  pnpm: 8.15.7
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Performance

Which stage(s) are affected? (Select all that apply)

next build

Additional context

No response

feedthejim commented 5 months ago

thanks for reporting, we identified it to an issue with node-file-trace, but we're still unsure why concat messes with it