vscode-postgres
                                
                                 vscode-postgres copied to clipboard
                                
                                    vscode-postgres copied to clipboard
                            
                            
                            
                        Result rendering is slow
select * from information_schema.columns; on a small-ish database takes 7 seconds to display 1885 rows in the results grid. Scrolling is also slow in that window.
Some of that might be alleviated with an upgrade to WebViews. But either with the current method, or the new one - it still has to generate an html table for all 1885 rows.
I don't think 2000 rows is that much. Maybe rendering the table is really slow? Sorry, I don't do web dev, so I don't feel too comfortable building the extension with added timing code.
Yeah, buildTable takes 70 ms or so, while executeCommand('vscode.previewHtml' takes 580 ms. The rest of the time must be spent somewhere else.
My guess is in the layout engine. It is trying to determine the size of the columns for all those rows.
The latest version 1.1.0 has switched from using the TextDocumentContentProvider to using a Webview. It would be interesting to know if that helps performance.
Still 7 seconds :smile:.
With it more than likely being in the layout engine, there is only one thing I can think of to improve performance - paged results.
It's not the first time I've thought of paged results, but now in the Webview is doable. Though with paged results sometimes the two rows someone may want to compare might be on separate pages.
paged results
On noes!
An alternative might be to used fixed sizes for the columns (and rows) and/or table-layout: fixed.
Yeah, about my reaction to the paged results too... I'd do it if I had to, but I will avoid it if I can.
Fixed sizes... about the same, mainly because of the hidden content they would contain - unless I can find a way to drag to resize...
The table-layout idea is fairly easy to try. Will try it when I get a chance.
Surely there is some sort of data-grid library that supports resizing and copying the cell contents, right? Maybe one that supports virtualization (so that DOM elements are created only for what's visible on screen) -- or not, if it breaks CTRL-F and other stuff.
Maybe, but light-weight ones, I don't want to have the library slow it down either.
I found one, but it depends on the row height being consistent - which doesn't really work.
it depends on the row height being consistent
It might be a good idea to have constant row heights (and column widths), as long as they're resizable.
This one is reasonably fast, but uses virtualization.