Skip to content

Techdraw: draw scene faster#28702

Merged
maxwxyz merged 3 commits intoFreeCAD:mainfrom
Lgt2x:techdraw-draw-perf
Mar 27, 2026
Merged

Techdraw: draw scene faster#28702
maxwxyz merged 3 commits intoFreeCAD:mainfrom
Lgt2x:techdraw-draw-perf

Conversation

@Lgt2x
Copy link
Copy Markdown
Member

@Lgt2x Lgt2x commented Mar 26, 2026

After #25898 , interacting with the TechDraw canvas view is still slow with large models. After analysis, most of the time taken to draw the view is now spent looking up parameters EdgeFuzz and MarkFuzz. Looking up parameters is expensive due to the design of Base/Parameter.cpp: every time a parameter group or value is looked up, the XML Xerces object is iterated recursively until the item is found. When doing that for every edge in the view, it is very time-consuming.

There is probably work to be done to make Parameter.cpp more efficient by changing the internal structures, but this is work for another day. This fix goes the simpler route of storing parameter value when the item is created, and using the memorized value afterwards.

This breaks the feature of hot-reloading the parameter value when the settings are changed, but I don't think this is a big deal, it is an advanced parameter that barely anyone would change anyways.

Issues

#24191

Before and After Images

On a moderately large scene (~1000 vertices+edges), paint time jumps from 200ms to 50ms.

No LLM was used in the writing of this PR.

@WandererFan

Lgt2x added 3 commits March 26, 2026 21:24
Most of the time spent drawing the view in TechDraw is spent looking up parameters. Now, load EdgeFuzz/MarkFuzz parameters only during initialization to avoid looking for them in the XML structure everytime the scene in painted. This improves TechDraw interactivity by a lot when dealing with large models.
@github-actions github-actions bot added the Mod: TechDraw Related to the TechDraw Workbench label Mar 27, 2026
@maxwxyz maxwxyz requested a review from WandererFan March 27, 2026 05:43
@maxwxyz maxwxyz linked an issue Mar 27, 2026 that may be closed by this pull request
2 tasks
@maxwxyz maxwxyz added this to the 1.2 milestone Mar 27, 2026
@maxwxyz maxwxyz added the Type: Feature FR for improvements or new features label Mar 27, 2026
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Mar 27, 2026
Copy link
Copy Markdown
Contributor

@WandererFan WandererFan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

desk check of code looks fine. Not tested.

@chennes chennes requested a review from maxwxyz March 27, 2026 14:21
@maxwxyz maxwxyz added the Approved: Code Quality The PR was checked for code quality and approved label Mar 27, 2026
@maxwxyz maxwxyz moved this from Merge Meeting to Approved in Merge Queue Mar 27, 2026
Copy link
Copy Markdown
Collaborator

@maxwxyz maxwxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works and is fast.

@maxwxyz maxwxyz added the Approved: Tested The PR was manually tested and approved label Mar 27, 2026
@maxwxyz maxwxyz merged commit 58cf127 into FreeCAD:main Mar 27, 2026
17 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Merge Queue Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved: Code Quality The PR was checked for code quality and approved Approved: Tested The PR was manually tested and approved Mod: TechDraw Related to the TechDraw Workbench Type: Feature FR for improvements or new features

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Draft: Slow performance

3 participants