-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Cold build takes upwards of 50 minutes, high transformTime #39969
Comments
Hi, this is a little hard to diagnose without access to the code - have you looked through the emitted JS/DTS files to see if anything is spectacularly large like in the issue you linked? |
Here's a few other questions:
@amcasey might also have some stuff in the works to help us understand where time is being spent in the compiler. |
Also, I've heard that increasing Node's max heap size has helped others with transform-time speed issues so that garbage collection doesn't get triggered as often, which is at least useful as a workaround for you.
|
@DanielRosenwasser No harm in trying, but the memory usage doesn't look excessive and the check time is reasonable, so I don't guess Regarding tooling, I've been focused on check time, but it should be easy enough to put together a private build that can say something useful about where this time is going. @JakeFDev This is a new one for me - most users report slowdowns in module resolution or check time. It also seems strange to me that we could spend so much time on emit and so little on file I/O. |
@orta I don't see anything big sticking out. The entire output folder of the build is ~1.7MB which doesn't seem out of question. Looking through the files everything is 500bytes up to 22KB. Going to try running the suggestions, i'll report back. |
@amcasey using your build I discovered some weird things in some of our legacy code (thats in js) The file in question exports its module like so
Only the legacy, old code exports this way. That takes 37 seconds according to the transform debug build. I changed it to
And now the same file took 22ms. I will need to basically update every file that is using this approach and will update as I go if this is the problem. |
That was it. Cleaned up all those instances, down to a 15 second fresh build time. Thanks everyone for the help! |
@JakeFDev That's great! Any chance you can anonymize one of your old files and share it as an example? I'd like to dig in and figure out why the transformation takes so long. |
@amcasey this file is pretty simple. As is, this is the one that took 37 seconds before the change const mongoose = require('mongoose');
const timestamps = require('mongoose-timestamp');
const beautifyUnique = require('mongoose-beautiful-unique-validation');
const VisitSchema = new mongoose.Schema({
trackingId: {
type: String,
trim: true,
required: true
},
date: {
type: String,
trim: true,
},
count: {
type: Number,
required: true,
trim: true
},
group_id: {
type: String,
trim: true
}
},{
collection: 'visit',
timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' }
});
//BatchSchema.plugin(bcrypt);
// VisitSchema.plugin(timestamps);
// Enable beautifying on this schema
VisitSchema.plugin(beautifyUnique);
export const Visit = mongoose.model('Visit', VisitSchema);
module.exports = exports = Visit; |
@JakeFDev Thanks! Could you possibly share your tsconfig as well? I used some safe defaults, but mine only takes 2 seconds (in nightly). Edit: I'm an idiot - it's at the top. Edit 2: Still nothing.
|
@JakeFDev Are you using |
@amcasey we are running it as part of a script in our package.json "build": "yarn run build-ts",
"build-ts": "tsc",
... |
Still nothing. 😢 Given that you're unblocked, we might have to let this go until we hear other reports. Thanks again! |
TypeScript Version: 3.8.3, however I have tried 3.3.x as well as the latest 3.9.x and even updating the the rc version of 4.0
Search Terms:
Fresh/cold build takes upwards of 50 minutes, both watch and regular build mode. Very high transform time.
Code
This is a private repo I started contributing too so I can't share it, but this is our tsconfig.
Expected behavior:
Running a fresh build (without a .buildinfofile and the current dist folder if one exists) should compile in less time than it takes to do my laundry
Actual behavior:
Running a fresh build takes upwards of 1 hour, although I have seen a range of 35-50 minutes that is most common.
Related Issues:
#35729
The text was updated successfully, but these errors were encountered: