wiremod / advdupe2

Advanced Duplicator 2
http://wiremod.com
Apache License 2.0
91 stars 61 forks source link

Make browser loading faster #467

Closed marchc1 closed 3 months ago

marchc1 commented 6 months ago

This is temporary just to fix a problem I've been annoyed by for a year or two now. At some point in the future, I want to actually recode the entire file browser. I just don't have the time for that right now.

I have not confirmed 100% if this works for Advdupe 1 or the Public folders.

thegrb93 commented 6 months ago

You're adding each file to the tree one per think now? I really don't see how this makes loading faster.

I'm guessing what it is actually doing is preventing lag when opening a folder with a huge number of files? I don't think this would really prevent that either since the file.Find is where most of the latency would occur.

marchc1 commented 3 months ago

You're adding each file to the tree one per think now? I really don't see how this makes loading faster.

I'm guessing what it is actually doing is preventing lag when opening a folder with a huge number of files? I don't think this would really prevent that either since the file.Find is where most of the latency would occur.

Sorry I didn't realize you commented on this for two months. I didn't get a notification and completely forgot.

This does prevent lag. file.Find is not where the latency is unless maybe you're using a slow hard drive; it's the creation of VGUI elements. Only at EXTREMELY large (and unrealistic) scales would it be a noticeable file.Find bottleneck. Advdupe2 is making every single folder and file node at the same time.

I proved this in an unfinished PR I was working on which loaded my advdupe2 folder nearly instantaneously vs. taking 5-10 seconds to load. It created a singular scroll-able element that did more immediate-mode rendering rather than a node for every file. That loaded even faster than this PR did. So it definitely is not a file.Find bottleneck.

thegrb93 commented 3 months ago

Forgot about this too. Still not a fan of the think hook, but whatever

marchc1 commented 3 months ago

Forgot about this too. Still not a fan of the think hook, but whatever

In the future, if I can ever finish my PR (may request someone to help me finish it, async file operations were being a real annoyance), it won't use the think hook anymore. This is basically just a band-aid until I can finish my file browser revamp. But thank you for approving this in the meantime