xircuits
xircuits copied to clipboard
Improve performance by introducing a flag to disable context change listener during internal updates
Description
This pull request addresses a performance issue caused by redundant processing when updating the document model. The problem stems from the fact that the current implementation listens for a change and then sets the current document model to the serialized graph JSON. Shortly after, there is a document model change listener that reacts to this change and deserializes the new graph, setting the new model. This results in unnecessary work being done during the update process.
To fix this issue, a modelUpdateInProgress
flag has been introduced. This flag is used to disable the context change listener when the update is initiated from within the context. By doing so, we prevent the redundant processing and improve overall performance.
Pull Request Type
- [ ] Xircuits Core (Jupyterlab Related changes)
- [x] Xircuits Canvas (Custom RD Related changes)
- [ ] Xircuits Component Library
- [ ] Xircuits Project Template
- [ ] Testing Automation
- [ ] Documentation
- [ ] Others (Please Specify)
Type of Change
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
Tests
Manual testing with both small and large xircuits files. Previously a distinct slowdown was apparent, afterwards it is gone.
Tested on?
- [x] Windows
- [ ] Linux Ubuntu
- [ ] Centos
- [ ] Mac
- [ ] Others (State here -> xxx )