vscode-postgres icon indicating copy to clipboard operation
vscode-postgres copied to clipboard

Result rendering is slow

Open lnicola opened this issue 7 years ago • 11 comments

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.

lnicola avatar Aug 17 '18 08:08 lnicola

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.

Borvik avatar Aug 17 '18 10:08 Borvik

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.

lnicola avatar Aug 17 '18 10:08 lnicola

Yeah, buildTable takes 70 ms or so, while executeCommand('vscode.previewHtml' takes 580 ms. The rest of the time must be spent somewhere else.

lnicola avatar Aug 17 '18 13:08 lnicola

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.

Borvik avatar Sep 03 '18 13:09 Borvik

Still 7 seconds :smile:.

lnicola avatar Sep 05 '18 09:09 lnicola

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.

Borvik avatar Sep 05 '18 09:09 Borvik

paged results

On noes!

An alternative might be to used fixed sizes for the columns (and rows) and/or table-layout: fixed.

lnicola avatar Sep 05 '18 09:09 lnicola

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.

Borvik avatar Sep 05 '18 10:09 Borvik

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.

lnicola avatar Sep 05 '18 16:09 lnicola

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.

Borvik avatar Sep 07 '18 09:09 Borvik

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.

lnicola avatar Sep 07 '18 10:09 lnicola