Skip to content

Trust corefinement more (fenced under feature) for even more speedups#4101

Merged
t-paul merged 10 commits intoopenscad:masterfrom
ochafik:trust_corefinement
Feb 9, 2022
Merged

Trust corefinement more (fenced under feature) for even more speedups#4101
t-paul merged 10 commits intoopenscad:masterfrom
ochafik:trust_corefinement

Conversation

@ochafik
Copy link
Contributor

@ochafik ochafik commented Feb 8, 2022

TL;DR: Up to 3x faster fast-csg by enabling fast-csg-trust-corefinement (might get a couple of crashes, please report with the .off files generated when --enable=fast-csg-debug-corefinement is passed in CLI).

In the early days of #3637 I was optimistic for 10x to 100x improvements with corefinement operations instead of Nef polyhedron (see these old benchmarks). But the fast-csg feature that’s just landed in Nightly builds (#4087), only realistically bring 3x to 10x speedups. The difference is because the corefinement library can be finicky with the inputs it gets, and can throw / at times corrupt the mesh when it’s given bad inputs. I’ve added checks to avoid those error cases proactively but they're so expensive some files are just 3x slower.

So… this PR adds two experimental features:

  • fast-csg-trust-corefinement: an override that says “yeah go ahead and use refinement without any checks, let’s see if it crashes & try to recover gracefully 🤞”
  • fast-csg-debug-corefinement: this will create one .off file per operand of each corefinement operation (in the working directory, which... is unclear what is is on MacOS X unless you use the CLI). If a user's model crashes and they're willing to share the generated OFFending files, we can use them to file bugs to CGAL and/or find lighter ways to prevent the bad cases from being sent to corefinement routines.

Olivier Chafik added 2 commits February 8, 2022 03:00
…ns w/ prechecks

Some benchmarks up to 3x faster.
…lhs/rhs operands

Usage example:

./OpenSCAD \
  tests/data/scad/3D/features/edge-cases.scad \
  --enable=fast-csg
  --enable=fast-csg-trust-corefinement \
  --enable=fast-csg-debug-corefinement \
  -o out_notrust.stl

ls *.off
@ochafik ochafik changed the title Trust corefinement Trust corefinement more (fenced under feature) for even more speedups Feb 8, 2022
Copy link
Member

@t-paul t-paul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code change looks good but it seems like some build files got included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants