Skip to content

Expression Completer: speedup property completion#27137

Merged
sliptonic merged 2 commits intoFreeCAD:mainfrom
Lgt2x:speedup-expression-completer
Jan 26, 2026
Merged

Expression Completer: speedup property completion#27137
sliptonic merged 2 commits intoFreeCAD:mainfrom
Lgt2x:speedup-expression-completer

Conversation

@Lgt2x
Copy link
Copy Markdown
Member

@Lgt2x Lgt2x commented Jan 24, 2026

Cache object property list in expression completer, so it is not rebuilt for every requested index. This helps with performance when an object has a large number of properties.

Before this change, getCachedPropertyNamedList was called for every index property of the object, creating a new list every time. This had a significative impact on completion speed when the number of properties is in the thousands.

A new ExpressionCompleterModel object is created every time the expression dialog is brought up, so there should not be cache invalidation issues (feel free to confirm that).

mutable keyword is required for const-correctness.

Issues

Fix #5644 (originally opened almost 10 years ago!)

Before and After Images

On this statefile, open an expression dialog:

prop_complete.FCStd.zip

This file has an object with 10k props.

Before change (real time):
Prop_bugged

After change:
Prop_fixed

Cache object property list in expression completer, so it is not rebuilt for every requested index. This helps with performance when an object has a large number of properties.
@github-actions github-actions bot added the Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD label Jan 24, 2026
@kadet1090 kadet1090 added Approved: Code Quality The PR was checked for code quality and approved Requires: Testing The PR needs testing by users and developers labels Jan 24, 2026
@maxwxyz maxwxyz added Type: Bug This issue or PR is related to a bug backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 labels Jan 25, 2026
@maxwxyz maxwxyz added this to the 1.1 milestone Jan 25, 2026
@maxwxyz maxwxyz moved this from Queue to Approved in Merge Queue Jan 25, 2026
@sliptonic sliptonic merged commit bf92b99 into FreeCAD:main Jan 26, 2026
17 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Merge Queue Jan 26, 2026
@freecad-ci-runner
Copy link
Copy Markdown
Collaborator

Successfully created backport PR for releases/FreeCAD-1-1:

@galou
Copy link
Copy Markdown
Contributor

galou commented Jan 30, 2026

@Lgt2x this is great! Now that you are a completion expert, I'd like to try and implement a FreeCAD setting to switch between only listing Labels in the expression editor (but still allowing Names even if not proposed) and listing both Names and Labels (current behavior). Where should I start?

@Lgt2x
Copy link
Copy Markdown
Member Author

Lgt2x commented Jan 30, 2026

Hey @galou , I suggest you open a dedicated issue, to get feedback from the design working group. Once the design has been validated, implementation should be pretty straightforward

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 backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Requires: Testing The PR needs testing by users and developers Type: Bug This issue or PR is related to a bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Expression: auto-completer slows down FreeCAD

6 participants