New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Rollup2.7+] vite build is slow ,vite transform 10000+ file( 2000+[vue] file), It takes 2 hours to build a mac os air #4732
Comments
From the other thread
It is an optimization to reduce the emitted number of chunks in the following scenario // main.js
import { a } from './a.js';
import('./b.js');
console.log('main', a);
// a.js
export const a = 'a';
// b.js
import { a } from './a.js';
console.log('b', a); Output without this optimization: Three separate chunks But this optimization indeed could be potentially costly. I however did not have a large enough code-base yet to see the effect. One could potentially improve performance here by reducing the situations in which this optimization is applied, or other things. I would like to work on this soon to improve the situation, and your reproduction could help a lot to try out some things. Unfortunately I do not speak Chinese. Can you give me instructions in English how to "run" your reproduction to see the issue? What do I need to do after checking out the repository? |
|
Thanks , As above |
Unfortunately, I did not manage to reproduce the problem because for me, the build always failed much earlier due to unrelated issues. Still, I took some time to rewrite the critical part of the chunking algorithm in a way that hopefully performs better in #4736. As your reproduction still uses Vite 2 and an older version of Rollup, I created a beta version of the patch based on rollup@2.77. Can you please try it out and give me feedback by installing |
This is new single vite2 repo: https://github.com/cayweb778/vite2rolluptest.git |
At present, I am using this this for testing. Everything is normal |
Seems to be slower, 4s * 7000/60/60=9-hour+, Even doing 24-hour+ -- dynamicEntriesToHandle has 3731926 elements |
Thanks for the new reproduction, I was actually able to work with this. Based on this, I decided to finally make the algorithm slightly simpler. Now it will not always create ideal chunks, but it still will in most case. For me, it now generates the chunks in around 30s. You can try it out via rollup@2.77.4-1 |
|
If you want to say you still have performance issues there, I fear you will need to update to Rollup 3/Vite 4. This part has been completely reworked here and also a performance issue has been fixed. But I do not have the bandwidth to port a fix to Rollup 2. |
thank you very,base on this.i will update vite3 +,this may tak some time,hope on rollup 3.xx may use this improve, Can you tell me the specific version of 3.xx or 4.xx |
funciton |
If possible, I will report to vite. |
Can I move this task to Rollup 3+, vite 4+. I have updated the repo dependency to expect future support, repo: https://github.com/cayweb778/hello.git rollup3.6 + vite4.x issue : #4740 |
rollup3 + vite4.x issue : #4740 |
This issue has been resolved via #4736 as part of rollup@3.7.2. You can test it via |
Rollup Version
2.79.1
Operating System (or Browser)
macos
Node Version (if applicable)
16.9
Link To Reproduction
https://github.com/cayweb778/vite2rolluptest.git
Expected Behaviour
中文:
我需要帮助!!
问题描述: vite build,开发了 2000+ "vue file", 构建需要transform 10000+文件
问题节点: ”assignEntryToStaticDependencies 构建缓慢“
问题描述: macos air需要构建2小时, 低性能服务器需要6小时左右
rollup新版本有所改进么?
调试过程( 正在进行 )
5.去掉add,速度还ok,定位到add引起的缓慢,看看add的变量到底存了什么
9,
dynamicallyDependentEntryPointsByDynamicEntry :
entryPoints
containedIn
每次modulesToHandle才1000左右,但areEntryPointsContainedOrDynamicallyDependent中的add进行了5亿次,
继续排查
dependentEntryPointsByModule :
modulesToHandle 是 1000个入口模块中的一个
英文:
I need help!!
Problem description: vite build, developed 2000+"vue file", and build requires transform 10000+files
Problem node: "assignEntryToStaticDependencies are slowly constructed“
Problem description: It takes 2 hours to build a mac os air, and about 6 hours for a low performance server
Is there any improvement in the new version of rollup?
Debugging process (in progress)
Debug to the assignEntryToStaticDependencies function. It starts to get stuck and is being debugged further
It is judged that areEntryPointsContainedOrDynamically Dependent is stuck when you see it. There are two layers of for
This step of get and add may affect the speed
For has no content and is very fast. Test to remove add
Remove add, and the speed is OK. Locate the slow speed caused by add, and see what the add variable has
A massive add operation is found
-AssignEntryToStaticDependencies were added 500 million times at a time,
-Our project needs 1000 times, that is 500 billion add, which is quite terrible
Check why a large amount of add is needed
I tried another small project, transform4000+file, and found that only 35 times were needed, 7629 times were added, while this problem project had 1000 times, and the number of add times reached 500 billion times
9,
dynamicallyDependentEntryPointsByDynamicEntry :
entryPoints
containedIn
ten
Each time the modulesToHandle is only about 1000, but the add in areEntryPointsContainedOrDynamically Dependent has been performed 500 million times,
Continue troubleshooting
-So why do most dynamically imported modules have the subdependency index.html?
-If you only judge index.html, it will be more efficient to check it in the upper layer at one time
dependentEntryPointsByModule :
ModulesToHandle is one of 1000 entry modules
Actual Behaviour
我正在调试过程,
调试到assignEntryToStaticDependencies 函数,开始卡住,正在进一步调试
The text was updated successfully, but these errors were encountered: