Skip to content

refactor: idiomatic Rust improvements for performance and clarity#5

Open
niklabh wants to merge 1 commit intomainfrom
refactor/idiomatic-rust-improvements
Open

refactor: idiomatic Rust improvements for performance and clarity#5
niklabh wants to merge 1 commit intomainfrom
refactor/idiomatic-rust-improvements

Conversation

@niklabh
Copy link
Owner

@niklabh niklabh commented Mar 16, 2026

Summary

  • Remove redundant HostState::clone() in run_module — saves one full deep-clone per module load
  • Consolidate double mutex lock in render_toolbar into a single lock acquisition
  • Replace unconditional ctx.request_repaint() with status-aware repaint — idle state uses 200ms polling instead of burning CPU continuously
  • Remove db.flush() (fsync) on every KV write — sled manages its own flush schedule, this was a major I/O bottleneck

Test plan

  • Load a Wasm module and verify it runs correctly (clone fix)
  • Verify back/forward buttons still work correctly (mutex fix)
  • Verify UI remains responsive during module execution (repaint fix)
  • Verify UI doesn't burn CPU when idle (repaint fix)
  • Verify KV store data persists after writes (flush removal)

🤖 Generated with Claude Code

- Remove redundant HostState clone in run_module (runtime.rs)
- Consolidate double mutex acquisition in render_toolbar (ui.rs)
- Replace continuous repaint with conditional repaint to save CPU/battery
  when idle (ui.rs)
- Remove synchronous sled flush on every KV write, letting sled manage
  its own flush schedule for better I/O performance (capabilities.rs)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Warning

Rate limit exceeded

@niklabh has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9c2afe55-38d6-465c-8189-7e85871e27d1

📥 Commits

Reviewing files that changed from the base of the PR and between 62a9f61 and 437e73d.

📒 Files selected for processing (3)
  • oxide-browser/src/capabilities.rs
  • oxide-browser/src/runtime.rs
  • oxide-browser/src/ui.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/idiomatic-rust-improvements
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant