Skip to content
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

Significantly-faster package list loading and nearly-instant search, both provided by a DataView and its RowFilter. #140

Merged
merged 67 commits into from
Jan 24, 2022

Conversation

DrewNaylor
Copy link
Owner

@DrewNaylor DrewNaylor commented Jan 22, 2022

Thought this was going to be using VirtualMode and a Package class, but so far these changes are major improvements, so I might not do those unless necessary.

Current known bugs and issues:

  • The database isn't being closed after updating the cache, so it says that it's in use when I try to update again. (This should be fixed now, I hope. Mainly what I did was to have it clear the pools just before returning the datatable so that hopefully it's not in memory now.)
  • There aren't dropdowns/comboboxes in the Actions column right now, as I don't entirely know how to put them into DataTables. This is super important to ensure people can use it anyway they want. Edit: maybe I can just have it so that people can press spacebar when the Action column is the current column and open a makeshift menu for the Action items that's used instead of the previous dropdown. Edit 2: I just added the Ctrl+M keyboard shortcut so people can open the context menu in the top-left corner of the package list DataGridView, which is a lot less work and should be better than what it was before. People can still use Alt+S if they wish to open the Selected packages menu, which has the Ctrl+M button in it. Only potential issue is this'll cover up some of the packages, but for now, I don't have any other simple solutions that aren't more buggy than the previous dropdowns.
  • Actions and Status columns aren't auto-sized correctly.
  • Not really an issue, but there may be a lot of useless code that was necessary previously that doesn't present any noticeable problems that'll have to be removed.
  • TODO: I need to have a column for Installed version once there's a way to allow users to choose a different version to install rather than the latest version. This'll just be something I'll add in the future, rather than in this PR.

Additions:

  • New setting: DebuggingShowManifestPathColumn, Boolean, defaults to False. You can use this to show the ManifestPath column, as expected.
  • Since there's a way to know how many rows are currently being shown vs how many are loaded in total, the statusbar now displays the number of listed packages alongside the total number of loaded packages. This is sorta like what Synaptic does, except the number of packages marked in various ways isn't shown yet. Once I can get that working, I'll add that feature.
  • Column widths are now saved across refreshing the cache, which is effectively the same thing that happened last time, except this is necessary as we're removing everything from the datagridview on cache updates.
  • Show context menu button in the Selected packages menu to display the context menu for the package list, as a replacement for the removed Action column dropdowns. See the item on this in the Removals section for more details.

Fixes:

Removals:

  • Forgot about the ManifestType column, but I didn't add support for it in the new code. Copied over the commented-out code so it can be used if necessary, though it'll require changes.
  • We're not using the PackageInfo class or whatever it's called sometimes anymore, so I removed it completely and it's not just commented out now.
  • The Action column no longer has the dropdowns like it used to. Replacing that is the ability to single-click on any cell in the Action column to open the context menu instead of requiring a double-click, or pressing Ctrl+M to open the context menu directly without having to use the context menu key on the keyboard, as it may be difficult or impossible to access. You can still use any other way of marking packages that was previously available, including but not limited to opening the Selected packages menu with Alt+S.

Other changes:

  • Descriptions and manifest paths are loaded at the same time as the rest of the details are loaded from the database to make using the DataTable easier/possible. I decided to make the code that adds the rows to the datatable use Await Task.Run to try to speed it up, and it may help a little, but I'm not sure how much.
  • Libraries were updated.
  • Just so I don't miss this when writing the changelog, searches are now near-instant, and loading the package list is usually way faster, even on my desktop which is a Ryzen 5800X. I think it also uses a lot less RAM now too, usually staying under 80 MB of RAM, whereas before it would easily go into 120 MB or more. At least, that was based on the highest number in the memory usage graph in Visual Studio, so it's not exact. Sometimes it can use a lot more, too, so I need to figure out how to keep the memory usage lower. Running without the debugger makes package list loading faster, though rarely it's still really slow for some reason.
  • Instead of having the progressbar go up by 1 for each package, it now goes up every 100 packages when there are 100 or more in the list, goes up by 10 if there are 10 or more but fewer than 99 packages, and up by 1 if there are fewer than 10 packages. This may help improve performance by not constantly updating the UI thread.
  • Checking to see how many manifests are available is now done by using If ManifestPaths.Count = 0... instead of If ManifestPaths(0) = String.Empty to make sure it doesn't break as easily.
  • Loading from the Sqlite database into a DataTable is now done Async to hopefully not make things lock up as much. In my testing, I have only noticed guinget's titlebar say "(Not Responding)" once or twice, though there were a lot of times Task Manager said it wasn't responding, but most people probably wouldn't have Task Manager open and looking at guinget's process in particular.
  • HiDPI Mode now hides the package list and shows it again after changing the height for each row. This should help improve performance, though it's still slow, so I still recommend toggling it before loading the package list.
  • Instead of using AllCells for the autosizemode for the Action and Status columns, they're now using DisplayedCells. Hopefully this speeds things up.

use it for packages when saving and loading in virtual mode + add and rename a few of the properties.
I had to fix the vbproj files because Visual Studio decided to delete the "Form" subtype from the forms, preventing usage of the designer for them.
of the new virtual mode implementation, or whatever I'll use.
filling in the datatable + get rid of extra control-updating code.
I forgot that the SqliteTable has a different set of columns to the datagridview. Still need to get the long descriptions correctly.
Not sure how much this'll help, but I hope it at least helps a little.
the columns in here and I'm not sure how to access it outside.
This avoids the difficulty of figuring out how to properly remove then re-add them later.
Not sure if it needs to be turned off at runtime or not for better performance.
after searching if the search was the same as the one run previously.
bar if the current number of rows in the package list table is divisible by 100 when there are 100 or more packages (goes up by 100 in that case), if it's divisible by 10 when there are 10 or more but fewer than 100 packages (goes up by 10 in that case), or go up by 1 if there are fewer than 10 packages.
I still need to have the menu pop-up if the user single-clicks in the Action column.
disappear when marking them if you're not in the "All" view now.
It's not perfect, but it keeps keyboard functionality, and may be less finicky than the previous dropdowns.
for Properties and Show context menu so they're better and don't conflict.
moves the datagridview to the bottom of the lowest package row and it's more annoying than just sometimes showing a package longer than necessary.
the cache + don't unset or re-apply autosize as we're clearing the datagridview now so there's no point in unsetting it.
results, as it doesn't make sense to show the previously-selected package's details when there are no packages available. Been wanting to fix this for a while, and the new DataView and DataTable setup allow this to work. Fixes #17. This is one of the oldest still-opened issues.
rather than the datagridview, or we won't get everything depending on what the DataView filter is set as.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant