Getting rid of unnecessary recomputes

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Getting rid of unnecessary recomputes

Post by wmayer »

No, at least not so easily. And besides that the code would be each time different anyway for the appropriate slot function (connected to the toggled signal). There you have to block the signals of the other controls which are different for each dialog.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Getting rid of unnecessary recomputes

Post by wmayer »

in git ee37672 you'll a reference implementation how the update checkbox can be realized.
jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Re: Getting rid of unnecessary recomputes

Post by jrheinlaender »

What about implementing a check in PropertyXYZ::setValue(_somevalue_) that only changes the property if _somevalue_ is different from the current value? In that way we would also save recomputes in other cases, e.g. the user starts to edit the value but doesn't change it
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Getting rid of unnecessary recomputes

Post by wmayer »

Some years ago I tried this idea too but it led to a lot of trouble and inconsistencies so that I didn't follow further this approach.
jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Re: Getting rid of unnecessary recomputes

Post by jrheinlaender »

Some years ago I tried this idea too but it led to a lot of trouble and inconsistencies so that I didn't follow further this approach.
OK, next idea: Implement a "lock" for the feature (at the PropertyContainer level?) which simple doesn't set the "touched" StatusBit no matter how many Properties are changed, until the lock is released
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Getting rid of unnecessary recomputes

Post by wmayer »

OK, next idea: Implement a "lock" for the feature (at the PropertyContainer level?) which simple doesn't set the "touched" StatusBit no matter how many Properties are changed, until the lock is released
I once wanted to have this too but couldn't convince Jürgen. He said it's too dangerous that if a developer of a 3rd party module isn't carefully enough (i.e. to unlock it again) the recomputation of the document might be partially broken.
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Getting rid of unnecessary recomputes

Post by shoogen »

I recently created a floor plan using the sketcher. At the time i had about 200 Constraints and 20 remaining DOFs the recompute took rediciously long (about 30 seconds) even though the the time was not spend solving the sketch.
Could such a lock help in such a situation?
Post Reply