Skip to content
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

perf(tui): only rerender if a non-tick event has been received #9121

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

chris-olszewski
Copy link
Member

Description

ratatui does a great job of only updating cells that are different between render, but constructing the vt100 screen can be intensive.

This PR avoid constructing the screen if there are no updates to the the app state meaning there's no reason to re-render the TUI.

There are some additional changes we can also make to lower CPU usage more:

Testing Instructions

Using TUI in next.js

pnpm dev -F next

Before
Screenshot 2024-09-06 at 12 40 07 PM

After
Ran via cargo build -p turbo --release and turbo_dev --skip-infer dev -F next
Screenshot 2024-09-06 at 12 31 00 PM

Copy link

vercel bot commented Sep 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 4:41pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm
examples-gatsby-web ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm
examples-native-web ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm
examples-svelte-web ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm
examples-tailwind-web ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm
examples-vite-web ⬜️ Ignored (Inspect) Sep 6, 2024 4:41pm

@chris-olszewski chris-olszewski merged commit c84638a into main Sep 6, 2024
40 checks passed
@chris-olszewski chris-olszewski deleted the olszewski/perf_tui_high_cpu branch September 6, 2024 17:45
unstubbable added a commit to vercel/next.js that referenced this pull request Sep 16, 2024
This version of Turborepo reduces the CPU usage when running `pnpm dev`
(via vercel/turborepo#9121).
unstubbable added a commit to vercel/next.js that referenced this pull request Sep 16, 2024
This version of Turborepo reduces the CPU usage when running `pnpm dev`
(via vercel/turborepo#9121).
unstubbable added a commit to vercel/next.js that referenced this pull request Sep 16, 2024
This version of Turborepo reduces the CPU usage when running `pnpm dev`
(via vercel/turborepo#9121).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants