-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Speed-up view.FindSidebar #1357
Conversation
Can you provide more context. How much is the improvement? Is maintaining a font the only option? If there are adjustments needed, which are these and why are they not included in the pull request? |
I recorded a screen to show the difference.
List Virtualization would be an effective solution for slow FIND sidebar. But implementing by myself takes time and efforts. Netron's current implementation uses so called External symbol sprite for the icons, it seems like there're other faster methods but I guess using a web font is the quickest.
Compared to the original SVG icons, Connections icon and Weights icon based on the icon font look thin. So I need to adjust its shapes using SVG editor software such as Inkscape. It's because of haste they aren't included in this PR. |
Calling Document: createElement() method to create a lot of list items is time-consuming. So I've updated the code to use Node: cloneNode() method. I've also updated the font again. The icons look almost pixel identical now. |
Here beru@56118a1 is another version that doesn't use a web font. We can see that the other changes are still beneficial. |
While testing with efficientdet-d3.onnx file, I've noticed that repeatedly opening and closing the FIND Sidebar makes the app screen broken. The problem reproduces with current
|
There's a different idea. Instead of creating an |
Let's switch to this approach if it has some of the same benefits (new pull request or replace this one). Custom font files are harder to maintain and given this issue hasn't been reported widely seem an expensive trade-off. If there are other options we should try them as well. The main improvement in this change is from cloning nodes? If so could this be accomplished by remembering the first node created which would avoid the need for
Creating and reusing existing SVG elements as items come into view or become invisible might be another idea? Which part of using individual SVG icons makes this slow? Is this happening on all machines and browsers or specific configurations? |
I'll create a new pull request.
I understand so I'll try different approaches.
I believe so. If I remember correctly, the use of
I'm not really sure about that. My understanding is that when DOM nodes are added to on-screen DOM tree, it can cause frequent layout calculations. By using the DocumentFragment, that can be avoided/reduced.
I think that's what's called List Virtualization technique. https://tghosh.hashnode.dev/rendering-large-lists-in-vanilla-js-list-virtualization
I've checked that use of
This happenes on all Chromium-based browsers/applications. |
This PR attemps to speed-up FIND sidebar by replacing SVG icons with font letters.
I used https://icomoon.io/app/ to create
netron.woff
font file. I also used https://iconly.io/tools/svg-convert-stroke-to-fill to convert strokes to fills in SVG files.To check speed difference, efficientdet-d3.onnx file can be used.
Rasterized shapes of icon letters are somewhat different from original SVG icons. So some adjustments would be needed...
Before/After