insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

perf: Improve performance with large OpenAPI files [INS-3724]

Open CurryYangxx opened this issue 1 year ago • 4 comments

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

CurryYangxx avatar Apr 29 '24 09:04 CurryYangxx

can you describe your reasoning for choosing workerpool over alternative approaches please, eg utilityprocess

jackkav avatar Apr 29 '24 15:04 jackkav

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.

CurryYangxx avatar Apr 29 '24 15:04 CurryYangxx

we have code mirror linter running in the renderer right now, perhaps we can run spectral in a similar way? worth exploring?

jackkav avatar Apr 30 '24 08:04 jackkav

We solve this issue in another appraoch in #7374. This PR is reserved for future use of the node worker treads

CurryYangxx avatar May 14 '24 07:05 CurryYangxx