status/submit pane is DEAD slow with long list of files

Bug #779529 reported by Alexander Belchenko
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Bazaar Explorer
Confirmed
High
Unassigned

Bug Description

status and submit panes have very poor performance when there is many changes to show. We need to find the ways to cheating and avoid slow and unresponsive ui.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Some numbers (float numbers are time of execution in seconds):

SubmitView.refresh_view started
SubmitView.report_text started
SubmitReport._collect_data started
Using submit branch file:///C:/work/Python/send2trash/.bzr/branches/explorer/
changes_between_trees started <RevisionTree instance at 1a85c70, <email address hidden>
pkv'> <RevisionTree instance at 1ab8cb0, <email address hidden>'> None False
changes_between_trees finished 0.265000104904
SubmitReport._collect_data finished 0.406000137329
SubmitReport.full_report started
SubmitReport.body_lines started
SubmitReport.body_lines finished 0.0469999313354
SubmitReport.full_report finished 0.0469999313354
SubmitView.report_text finished 0.453000068665
SubmitView.refresh_view finished 12.1870000362

12 seconds!

Revision history for this message
Alexander Belchenko (bialix) wrote :

OK, I found that the slowest part here is QTextBrowser.setText(txt) where len(txt) = 246252. Very big txt, so no wonder it works soooooooo long. But in any case, that's kill entire explorer idea. Either we should find the way to make QTextBrowser faster or simply give up and throw it away.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Attached the real text explorer tries to set in QTextBrowser

Revision history for this message
Alexander Belchenko (bialix) wrote :

I can reduce this time down by using append() method instead of setHtml and don't set the entire text at once, but line-by-line. In this case I have 902 lines and time reduced down to 2.2 seconds.

Revision history for this message
Alexander Belchenko (bialix) wrote :

But this is still far from ideal.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Also SubmitView should not refresh itself if both branches are not changed (check by their last_revision_id() info).

Revision history for this message
Alexander Belchenko (bialix) wrote :

Fix for using append() instead setText() has committed to trunk. But there are more things we can improve.

Revision history for this message
Gordon Tyler (doxxx) wrote :

Try disabling updates / repaints before calling setText or append and re-enabled it afterwards.

Revision history for this message
Gordon Tyler (doxxx) wrote :

Also, if you don't already, try setting the text format explicitly so that setText/append don't have to figure it out.

Another option to explore is LogText mode. It's far more limited than RichText/HTML mode but there are some formatting options and it's supposedly faster.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 779529] Re: merge preview pane is DEAD slow

09.05.2011 15:09, Gordon Tyler пишет:
> Try disabling updates / repaints before calling setText or append and
> re-enabled it afterwards.

I'm not sure what do you mean or how to achieve that. But I should
note that I don't see any repaint, furthermore opening `bzr explore .`
from that branch I see long delay when explorer collects all data and
main window looks just empty and repainted.

--
All the dude wanted was his rug back

Revision history for this message
Alexander Belchenko (bialix) wrote :

09.05.2011 15:12, Gordon Tyler пишет:
> Also, if you don't already, try setting the text format explicitly so
> that setText/append don't have to figure it out.

I've tried setHtml instead of setText -- it did not help. And append()
method have no format argument.

> Another option to explore is LogText mode. It's far more limited than
> RichText/HTML mode but there are some formatting options and it's
> supposedly faster.

What is LogText? I don't see that in the list of classes.

--
All the dude wanted was his rug back

Revision history for this message
Alexander Belchenko (bialix) wrote :

09.05.2011 16:24, Alexander Belchenko пишет:
> 09.05.2011 15:09, Gordon Tyler пишет:
>> Try disabling updates / repaints before calling setText or append and
>> re-enabled it afterwards.
>
> I'm not sure what do you mean or how to achieve that. But I should
> note that I don't see any repaint, furthermore opening `bzr explore .`
> from that branch I see long delay when explorer collects all data and
> main window looks just empty and repainted.

I've tried to say; main windows looks just empty (transparent) and no
repaint occurs.

--
All the dude wanted was his rug back

summary: - merge preview pane is DEAD slow
+ status/submit pane is DEAD slow with long list of files
description: updated
Revision history for this message
Gordon Tyler (doxxx) wrote :

To disable repainting while a widget is being changed, call setUpdatesEnabled(False) before and setUpdatesEnabled(True) after.

It turns out the format thing can only limit to plain text. It accepts rich text by default. So no gain to be had there I think.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 779529] Re: status/submit pane is DEAD slow with long list of files

11.05.2011 3:27, Gordon Tyler пишет:
> To disable repainting while a widget is being changed, call
> setUpdatesEnabled(False) before and setUpdatesEnabled(True) after.

I've just added such guards around the code that add lines or set text
to QTextBrowser, but I don't see any help from that.

setHtml() time: 9.797 sec (without disable/enable)
setHtml() time: 10 sec (*with* disable/enable)

loop with append(): 0.906 sec (without disable/enable)
loop with append(): 0.922 sec (*with* disable/enable)

I think this results say enough without additional comments.

If somebody wants to play with this I've published my debug branch
which prints some statistics about update of status/submit panes to
stdout (so on Windows you should run manually `bzr explorer
path/to/branch`)

lp:~bialix/bzr-explorer/debug

look at lib/html_report_view.py: HtmlReportView.refresh_view

--
All the dude wanted was his rug back

Changed in bzr-explorer:
importance: Critical → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.