feat: offload JiveXML/JSON parsing to Web Worker to prevent UI freeze#856
Open
Shivansh1205 wants to merge 2 commits intoHSF:mainfrom
Open
feat: offload JiveXML/JSON parsing to Web Worker to prevent UI freeze#856Shivansh1205 wants to merge 2 commits intoHSF:mainfrom
Shivansh1205 wants to merge 2 commits intoHSF:mainfrom
Conversation
Collaborator
|
This is a bit hard to review because GitHub seems to think that you are adding I will have to look at this more carefully this evening. |
Collaborator
|
This is due to the fact that the new files is not in the right place in the hierarchy. Instead of being in path |
Contributor
Author
|
@sponce i will try doing it by this evening |
be2adc8 to
279e8d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
JiveXMLLoader.getEventData()runsDOMParser+ full XML data extraction synchronously on the main thread. For large ATLAS events with dense track collections, this causes multi-second UI freezes affecting every experiment (ATLAS, CMS, LHCb, TrackML).Solution — Phase 1: Worker-based parsing
The key insight: parsing + data extraction (expensive) can run in a worker, while Three.js object creation (needs WebGL context) stays on the main thread — but by that point the data is already structured and fast to process.
Changes
src/workers/event-data-parser.worker.ts— Web Worker that runsDOMParserand all JiveXML data extraction off the main thread, returning plain serialisable objects (no DOM nodes cross the worker boundary). Also handlesJSON.parsefor future use.src/workers/event-data-parser.ts— Promise-based wrapper with automatic synchronous fallback whenWorkeris unavailable (SSR, older browsers).src/loaders/jivexml-loader.ts—getEventData()is nowasync. Delegates XML parsing to the worker; privatebuild*()methods reconstruct the event data from the plain worker result.src/event-display.ts—buildEventDataFromJSON()andloadEvent()are nowasync.Considerations addressed