Skip to content

Conversation

@fredroy
Copy link
Contributor

@fredroy fredroy commented Jan 20, 2026

In a BeamAdapter scene where a catheter is deployed into deformable vessels, I got a huge discrepancy between LCPConstraintSolver (unbuilt) and UnbuiltGaussSeidelConstraintSolver (being the slowest).
Whereas the same scene (aka the standard scene 3instruments_collis where the catheter is deployed into static vessels, the difference is not that huge (~15-20% slower)

--> very important: wire_optimization must be true (more on that later)

Bench:

  • 5000 steps on 3instru_collis (static)
LCP : 5000 iterations done in 19.9832 s ( 250.21 FPS)
UGS:: 5000 iterations done in 23.5956 s ( 211.904 FPS)

  • 5000 steps on 3instru_collis (deformable)
LCP :5000 iterations done in 43.9782 s ( 113.693 FPS)
UGS: 5000 iterations done in 97.7162 s ( 51.1686 FPS)

For reference WITHOUT wire_optimization (set to False)

LCP :5000 iterations done in 63.7577 s ( 78.4219 FPS)
UGS: 5000 iterations done in 99.2367 s ( 50.3846 FPS)

We can see that wire_optimization seems to do nothing for UGS.

After investigation (thanks to Claude 🤖) it appeared that the re-ordering of the constraints was cancelled in the case of there is TWO constraint corrections (which is the case for the deformable vessels but not for the static vessels)

The loop calling resetForUnbuiltResolution on each ConstraintCorrection was resetting the ordering on the second iteration of the loop (e.g if the list is { LinearCC, UncoupledCC } then the first iteration will re-order fine but the second loop will reset the list and UncoupledCC do nothing for the re-oredering)

All in all the fix is easy, and set the initialization of the list outside the loop... 🤪

Results:

  • 5000 steps on 3instru_collis (deformable)
UGS: 5000 iterations done in 49.5163 s ( 100.977 FPS)

with the same ~15% difference as with the static vessel case.

✍️ Note that there should not be any difference between LCP and UGS but more to come about that....

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request topic for next dev-meeting PR to be discussed in sofa-dev meeting labels Jan 20, 2026
@fredroy fredroy force-pushed the fix_resetunbuiltcc_ugs branch from b64bf8d to adcd1fb Compare January 20, 2026 05:43
@fredroy
Copy link
Contributor Author

fredroy commented Jan 20, 2026

[ci-build][with-all-tests]

@fredroy fredroy added the pr: enhancement About a possible enhancement label Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: enhancement About a possible enhancement pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request topic for next dev-meeting PR to be discussed in sofa-dev meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants