Skip to content

perf: optimize picker performance with event queue and preview debouncing #38

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

Merged
merged 5 commits into from
Jul 6, 2025

Conversation

lambdalisue
Copy link
Collaborator

@lambdalisue lambdalisue commented Jul 6, 2025

Summary

  • Optimized event queue consumption with early return pattern and for loops
  • Added byte length caching for input component prefix/suffix
  • Implemented debounce for preview updates to reduce unnecessary renders
  • Optimized processor pipeline to avoid redundant reprocessing

Changes

  1. Event Queue Optimization: Replaced while loops with for loops and added early return when queue is empty
  2. Byte Length Caching: Cached byte length calculations for input component to avoid repeated computations
  3. Preview Debouncing: Added configurable debounce delay (default 150ms) for preview updates to prevent excessive rendering
  4. Processor Pipeline: Eliminated redundant processing in the pipeline

Performance Impact

These changes significantly improve the responsiveness of the fall picker, especially when:

  • Rapidly navigating through items
  • Working with large datasets
  • Using resource-intensive previewers

🤖 Generated with Claude Code

Copy link

codecov bot commented Jul 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.14%. Comparing base (e435174) to head (3bb15e4).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
+ Coverage   81.77%   82.14%   +0.37%     
==========================================
  Files          26       27       +1     
  Lines        1761     1798      +37     
  Branches      176      185       +9     
==========================================
+ Hits         1440     1477      +37     
  Misses        318      318              
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lambdalisue lambdalisue marked this pull request as draft July 6, 2025 11:11
@lambdalisue lambdalisue changed the title feat: implement performance optimizations for fall picker perf: optimize picker performance with event queue and preview debouncing Jul 6, 2025
@lambdalisue lambdalisue marked this pull request as ready for review July 6, 2025 12:47
lambdalisue and others added 4 commits July 6, 2025 21:53
Cache byte length calculations for prefix and suffix strings in InputComponent
to avoid repeated getByteLength() calls during rendering. This improves
performance when the same prefix/suffix values are used repeatedly.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Replace forEach with for loop for better performance and add early return
when event queue is empty. Also add comprehensive tests for event handling
including edge cases for large event counts and events dispatched during
consumption.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Modify picker event handlers to restart only the affected processor instead
of restarting from the matcher. When sorter changes, restart sort processor
with matcher output. When renderer changes, restart render processor with
sorter output. This avoids redundant matching operations.

Also implement copy-on-write for sort processor to prevent modifying the
input array, ensuring pipeline integrity.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@lambdalisue lambdalisue merged commit e892695 into main Jul 6, 2025
6 checks passed
@lambdalisue lambdalisue deleted the performance-imp branch July 6, 2025 12:55
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