You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ShapeUpgrade_UnifySameDomain with UnifyFaces=True causes severe performance degradation #1477
When using ShapeUpgrade_UnifySameDomain with UnifyFaces=True, I experience:
First call in a Python session takes 75-90 seconds (lazy initialization)
Environment
OpenCascade Version: 7.8.1 (via pythonocc-core)
Python Version: 3.12
OS: macOS (darwin 25.2.0)
Minimal Reproduction
Original Code
fromOCC.Core.STEPControlimportSTEPControl_ReaderfromOCC.Core.ShapeUpgradeimportShapeUpgrade_UnifySameDomain# Read STEP filereader=STEPControl_Reader()
reader.ReadFile("file_with_multiple_threads.step") # 465 facesreader.TransferRoots()
shape=reader.OneShape()
# Unify faces (SLOW!)unify=ShapeUpgrade_UnifySameDomain(
shape,
True, # UnifyEdgesTrue, # UnifyFaces - THIS IS THE BOTTLENECKFalse# ConcatBSplines
)
unify.Build()
unified_shape=unify.Shape()
Fast Alternative
# Just read the file, no unificationreader=STEPControl_Reader()
reader.ReadFile("file_with_multiple_threads.step")
reader.TransferRoots()
shape=reader.OneShape()
# Result: 465 faces (no reduction)# Problem: Circular planes split into hemispheres, cylinders split
Current Workaround
I observed that a warm-up strategy to mitigate the cold start:
# Warm up with small filedefwarmup_cad_reader(warmup_file: str="small_file.stp"):
"""Process small file to initialize OpenCascade caches"""reader=STEPControl_Reader()
reader.ReadFile(warmup_file)
reader.TransferRoots()
shape=reader.OneShape()
unify=ShapeUpgrade_UnifySameDomain(shape, True, True, False)
unify.Build()
returnTrue
ShapeUpgrade_UnifySameDomain has no cache or lazy initialization: the time is spent comparing the faces of your shape, so a warm-up on another file shouldn't make any difference. If you measured one, please share the timings of each step (read, fix, sew, unify) for the first and second call.
Also note that OCCT 8.0 fixes a case where UnifySameDomain could loop with 100% CPU on periodic surfaces (OCCT #557). It's not in any 7.x release. The next pythonocc-core release is based on OCCT 8.0.1. It would be worth testing your file with it once released (in progress).
Activity
tpaviot commentedon Jan 29, 2026
Can you please include the test step file and a code ready to be executed/tested
ChaitanyaYeole02 commentedon Jan 29, 2026
Test step file:
Step File with Multiple Threads
Executable Code:
@tpaviot
ChaitanyaYeole02 commentedon Feb 16, 2026
Hi @tpaviot ,
Just wanted to follow up on issue, when you get a chance. Just checking if you've had time to take a look at it.
tpaviot commentedon Sep 22, 2026
ShapeUpgrade_UnifySameDomain has no cache or lazy initialization: the time is spent comparing the faces of your shape, so a warm-up on another file shouldn't make any difference. If you measured one, please share the timings of each step (read, fix, sew, unify) for the first and second call.
Also note that OCCT 8.0 fixes a case where UnifySameDomain could loop with 100% CPU on periodic surfaces (OCCT #557). It's not in any 7.x release. The next pythonocc-core release is based on OCCT 8.0.1. It would be worth testing your file with it once released (in progress).