From 6894b0c9c3e5ba3e080cf364d5f6e68a760b2b8c Mon Sep 17 00:00:00 2001 From: phkahler <14852918+phkahler@users.noreply.github.com> Date: Sat, 15 Aug 2020 18:58:27 -0400 Subject: [PATCH] NFC: remove a critical section, runs faster. --- src/srf/boolean.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/srf/boolean.cpp b/src/srf/boolean.cpp index 296d6428..6c2443e1 100644 --- a/src/srf/boolean.cpp +++ b/src/srf/boolean.cpp @@ -624,16 +624,17 @@ SSurface SSurface::MakeCopyTrimAgainst(SShell *parent, } void SShell::CopySurfacesTrimAgainst(SShell *sha, SShell *shb, SShell *into, SSurface::CombineAs type) { + std::vector ssn(surface.n); #pragma omp parallel for for (int i = 0; i < surface.n; i++) { SSurface *ss = &surface[i]; - SSurface ssn; - ssn = ss->MakeCopyTrimAgainst(this, sha, shb, into, type, i); -#pragma omp critical - { - ss->newH = into->surface.AddAndAssignId(&ssn); - } + ssn[i] = ss->MakeCopyTrimAgainst(this, sha, shb, into, type, i); + } + + for (int i = 0; i < surface.n; i++) + { + surface[i].newH = into->surface.AddAndAssignId(&ssn[i]); } I += surface.n; }