Implement Asynchronous MIDI Processing for Improved Scalability#4647
Implement Asynchronous MIDI Processing for Improved Scalability#4647pushpitkamboj wants to merge 2 commits intosugarlabs:masterfrom
Conversation
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
@pushpitkamboj please provide a video of importing midi blocks more than 800 does that problem solved or not ??? |
|
✅ All Jest tests passed! This PR is ready to merge. |
Screen.Recording.2025-04-25.215933.mp4I tried my best to optimize but don't know if we can optimize it more with the existing processing on browser. Need to think of another alternatives to reduce the buffer for better UX. |
|
Your changes broke the unit test. |
|
@walterbender it's a good idea to give a text msg instead of refactoring midi importer |
|
I get it, maybe adding a warning message is better idea. |
Fix : #4626
Core Idea
The primary goal is to modify the transcribeMidi function to prevent browser unresponsiveness with large MIDI files by implementing asynchronous chunking and memory optimizations.
Async Processing
The core refactoring lies in processing the MIDI data in smaller chunks asynchronously to prevent the browser from freezing. The processChunk function, processes notes in small chunks and yield back to the main thread using setTimeout or async/await, which prevents locking up the browser during long operations.
Environment:
Operating System: Windows
Browser: Chrome
Checklist