Modeling - Skip redundant optimization for flat deviations in GeomLib_CheckCurveOnSurface#1373
Open
andymai wants to merge 1 commit into
Conversation
Member
|
Dear @andymai Thank you for your patch. To proceed with integration, please complete signing CLA process: In case if you already have signed CLA, please share ID that OCCT team shared with your by email after accepting of CLA. |
andymai
marked this pull request as ready for review
July 18, 2026 14:37
…_CheckCurveOnSurface GeomLib_CheckCurveOnSurface ran, per sub-interval, a ~310-evaluation math_PSO swarm, a math_NewtonMinimum polish that cannot converge on a flat deviation function (singular Hessian), and a second full swarm as the failure fallback - even when the 3xN control-point seeding had already shown the deviation is zero to machine precision. On analytic geometry this is ~18% of the total cost of a boolean operation. Accept the sampled deviation and skip the optimization pipeline when every control point lies below Precision::SquareConfusion(): immediately for fully analytic compositions, and after confirming flatness by resampling at half-step offsets otherwise. Non-flat inputs take the existing path unchanged. Boolean benchmarks (single-threaded): rounded-tool cut -20%, multi-solid fuse -17%, with bit-identical result shapes.
andymai
force-pushed
the
perf-geomlib-checkcurveonsurface-flat-fastpath
branch
from
July 18, 2026 14:41
3988a19 to
5ad5f30
Compare
Author
|
@dpasukhi CLA signed, just awaiting confirmation. |
dpasukhi
self-requested a review
July 22, 2026 14:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1372.
GeomLib_CheckCurveOnSurfaceruns, per sub-interval: a ~310-evaluationmath_PSOswarm, amath_NewtonMinimumpolish that is guaranteed to fail on flat deviation functions (singular Hessian), and a second full swarm as the failure fallback — even when the 3×N control-point seed sampling has already shown the deviation is zero to machine precision. On analytic geometry (line/circle on plane/cylinder/sphere/…, i.e. most prismatic CAD) this accounts for ~18% of the total cost of a boolean operation (callgrind numbers in #1372).This change accepts the sampled deviation and skips the optimization pipeline when every control point lies below the geometric noise floor (
Precision::SquareConfusion()on the squared distance):Sub-interval handling, the seeding itself, and every non-flat path are unchanged: any sampled squared distance above the noise floor falls through to the existing PSO + Newton pipeline. Deviations that are real but flat (e.g. a pcurve on a cylinder of a different radius) are above the floor at every sample, so they take the existing path — covered by the new gtest.
Measurements (single-threaded; details in #1372):
TargetFunc::Valueevaluations: 495 728 → 304 832 with the analytic gate alone; the confirmation resample removes most of the remainderBRepCheck_Analyzer)Validation:
boolean,blend,lowalgos: outcome sets identical between patched and unpatched builds on the same machine (2319 OK; identical pre-existing BAD/FAILED sets) — the change does not alter any test outcomeGeomLib_CheckCurveOnSurface_Test.cxxcovering a coincident analytic composition (zero deviation), a deviating analytic composition (real constant deviation must be measured, not swallowed by the fast path), and line-on-planeEspecially relevant for single-threaded consumers (WebAssembly builds), where
OSD_Parallelcannot hide the cost of this check.