perf: Improve performance with large OpenAPI files [INS-3724]
Close #4653 #4241
This PR is to solve the problem of slow response to open and edit spec files
The main reason is spectral.run spend too much time and block the main process
Changes:
- [x] remove the spectral lint logic in the loader
- [x] move spectral from main process to worker thread
- [x] add workerpool package to admin the worker
- [x] modify the spectralRun IPC
- [x] wrap code-editor with memo to reduce rerender
can you describe your reasoning for choosing workerpool over alternative approaches please, eg utilityprocess
can you describe your reasoning for choosing workerpool over alternative approaches please, eg utilityprocess
I read the electron documentation about the performance best practices, it says we can use worker threads for long running CPU-heavy tasks. And I think the spectral.run is the same situation.I found workerpool is convenient to admin workers ,so I choose this package.
we have code mirror linter running in the renderer right now, perhaps we can run spectral in a similar way? worth exploring?
We solve this issue in another appraoch in #7374. This PR is reserved for future use of the node worker treads