You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had 2 ideas to improve the performance of the new core (but not sure if they'll work.)
This could help alleviate perf concerns raised in a few issues (like #408) once we release the Inquirer rewrite.
Debouncing re-renders
The current hook implementation will always trigger a synchronous re-render. I think debouncing this slightly will help improve performance when multiple setState are called after each other.
This logic lives over here, the idea would be to review the handleChange implementation to maybe schedule a re-renders on a different loop that's debounced or timer base.
Contributions welcomed if you'd like to tackle!
Diff based re-rendering
On each re-renders, Inquirer clears the whole prompt content and re-renders it all. This is how the ScreenManager is implemented ATM.
I think we could be smarter and do a diff line by line and only clear/re-renders line by line. And we could even only re-renders the line from the point where it changes (comparing strings chars by chars.)
But there's 2 risks with this solution:
This will prevent us from bundling lines clear & cursor operations together
This will make the cursor position management logic more complicated
So it's an uncertain performance improvement... It could also lead to slower performance if the bundling of actions help the terminal render faster. It's unfortunate that terminals perform so differently between implementations and are kinda unknown compared to how well we understand browsers paint cycles today.
Any other ideas from you?
The text was updated successfully, but these errors were encountered:
I had 2 ideas to improve the performance of the new core (but not sure if they'll work.)
This could help alleviate perf concerns raised in a few issues (like #408) once we release the Inquirer rewrite.
Debouncing re-renders
The current hook implementation will always trigger a synchronous re-render. I think debouncing this slightly will help improve performance when multiple
setState
are called after each other.This logic lives over here, the idea would be to review the
handleChange
implementation to maybe schedule a re-renders on a different loop that's debounced or timer base.Contributions welcomed if you'd like to tackle!
Diff based re-rendering
On each re-renders, Inquirer clears the whole prompt content and re-renders it all. This is how the ScreenManager is implemented ATM.
I think we could be smarter and do a diff line by line and only clear/re-renders line by line. And we could even only re-renders the line from the point where it changes (comparing strings chars by chars.)
But there's 2 risks with this solution:
So it's an uncertain performance improvement... It could also lead to slower performance if the bundling of actions help the terminal render faster. It's unfortunate that terminals perform so differently between implementations and are kinda unknown compared to how well we understand browsers paint cycles today.
Any other ideas from you?
The text was updated successfully, but these errors were encountered: