trevorsandy / lpub3d

An LDraw™ editor for LEGO® style digital building instructions.
https://trevorsandy.github.io/lpub3d/
133 stars 19 forks source link

View Next Step takes almost 1.5 minutes #465

Closed AdvancedStyle closed 3 years ago

AdvancedStyle commented 3 years ago

Subject

I'm having a problem when scrolling to the next step on a large model (about 2300 pieces and 90 steps).

When I scroll between steps it takes almost 2 minutes using the native render engine.

Environment

Configuration

I'm using the default native render settings Only setting have i changed is turning "Buffered paging" off in the LDraw Editor settings.

Log output (after the point of clicking "Next Step")

INFO 2020-10-22T10:43:09.964 "" 
INFO 2020-10-22T10:44:28.427 "Generate CSI image for single-step page..." 
DEBUG 2020-10-22T10:44:28.430 "Draw page graphics - Elapsed time: 0.003 second" 
TRACE 2020-10-22T10:44:28.430 "LPub3D using Native render rendered page 2. Elapsed time: 1 minute 18.536 seconds" 
INFO 2020-10-22T10:44:28.430 "Counting document pages..." 
trevorsandy commented 3 years ago

Thank you for reporting this behaviour.

The second most expensive part of the draw-page block of routines is loading the LDraw Editor. This is linked to a Qt bottleneck on loading and decorating text in their QTextEdit widget. The elapsed time on this routine is affected by the number of lines in a given submodel so steps in a large submodel will take extended time to transition because the entire submodel is loaded into the Editor at each transition. This is further compounded by the rich text decoration theme. Buffered paging and a ’simple’ text decoration theme are settings that can help reduce the elapsed time to load the Editor but the most effective action is breaking large submodels into smaller ones.

The most expensive part of the draw-page block is counting pages - particularly pages with many substitute parts, callouts, step-groups etc... However, 90 pages should not present a significant impact.

The size of the model file, i.e. total number of parts, is not as much a factor in the draw-page routines elapsed time as is the model file design, i.e the layout of submodels, callouts, step-group pages, part substitutions etc...

Can you provide a larger portion of the log, if not the entire log ?

Cheers,

AdvancedStyle commented 3 years ago

Is there some way to get more verbose logging? What I pasted is everything that is output (from the point of clicking "Next" until the page appears)

trevorsandy commented 3 years ago

The default verbosity is sufficient. What I need is more context - i.e. the stuff that gets logged from the time the application starts to the time it abends.

Cheers,

trevorsandy commented 3 years ago

Fixed.

Cheers,