-
-
Notifications
You must be signed in to change notification settings - Fork 5
SF-3370 Add web worker and improve blot formats delta creation #3334
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
SF-3370 Add web worker and improve blot formats delta creation #3334
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3334 +/- ##
=========================================
Coverage ? 82.42%
=========================================
Files ? 607
Lines ? 35537
Branches ? 5784
=========================================
Hits ? 29291
Misses ? 5369
Partials ? 877 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
254b826 to
afef597
Compare
RaymondLuong3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is neat that using a web worker has such an advantage and allows you to offload the formatInsights from the main thread. I was testing this on a project with 18000 insights and there wasn't an issue for performance. The comlink library looks fantastic, it will be good to keep in mind for other expensive operations we might do that could block the main thread.
Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @siltomato)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/quill-services/quill-insight-render.service.ts line 38 at r1 (raw file):
if (Worker != null) { try { const worker = new Worker(new URL('./insight-formatting.worker', import.meta.url));
The examples I see on the comlink page use the file extension. Is that optional since you are not using it here?
Code quote:
'./insight-formatting.worker'src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/quill-services/quill-insight-render.service.ts line 103 at r1 (raw file):
this.workerApi[Comlink.releaseProxy](); } }
Nit: Move this method close to the constructor. It is often useful to see interface implementations near the beginning of the class.
Code quote:
ngOnDestroy(): void {
if (this.workerApi != null) {
this.workerApi[Comlink.releaseProxy]();
}
}afef597 to
44e6e8c
Compare
siltomato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was excited about the result as well.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @siltomato)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/quill-services/quill-insight-render.service.ts line 38 at r1 (raw file):
Previously, RaymondLuong3 (Raymond Luong) wrote…
The examples I see on the comlink page use the file extension. Is that optional since you are not using it here?
Yes, I believe so.
src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/quill-services/quill-insight-render.service.ts line 103 at r1 (raw file):
Previously, RaymondLuong3 (Raymond Luong) wrote…
Nit: Move this method close to the constructor. It is often useful to see interface implementations near the beginning of the class.
Done.
44e6e8c to
706cf86
Compare
This PR drastically improves loading speed and UI responsiveness for projects with very large numbers of insights (> 1000).
Comlinklibrary to improve working with web workers.delta.compose()after those cases and not after every insight (delta.compose()handles the case where insights have the same severity and overlapping ranges).This change is