perf(optimizer): start optimizer early#12593
Conversation
|
|
|
Somehow this PR makes the unit test more likely to segfault for some reason 😢 |
|
I dont think it is this PR, segfaults increased a lot in the past week |
|
I tested in |
| optimizeDeps: { | ||
| disabled: true, | ||
| }, |
There was a problem hiding this comment.
Not really. A lot of changes actually wasn't needed until node14 start messing up everything 😄 Only the first commit was the real changes.
But I think the changes are fine still including this one, since for this case the unit test won't spin up an unused deps optimizer instance (for this PR onwards). I'm happy to revert it too though and we can check separately.
Description
Currently the deps optimizer is inited only after the server is created and listening. However, the deps optimizer only relies on the server for module graph invalidation and page reload.
As these are technically optional if the server isn't ready yet, we should be able to init the optimizer before the server is created, which is what this PR does.
When the server is ready, we pass the server to the optimizer again for future server handling.
Additional context
Without this, we can't call
server.transformRequestearly on to pre-cache things, as we need the optimizer to properly resolve paths.With this PR, the optimizer can start 260ms earlier on a project I'm testing.
What is the purpose of this pull request?