Skip to content

docs(spec): spec 003, faster evaluation of faulted models - #384

Merged
lachlangrose merged 3 commits into
masterfrom
spec/003-fault-evaluation-performance
Nov 1, 2026
Merged

lachlangrose merged 3 commits into
masterfrom
spec/003-fault-evaluation-performance

Conversation

@lachlangrose

Copy link
Copy Markdown
Member

Adds specs/003-fault-evaluation-performance/. This PR has documents only, no code.

Why

Rendering a model with faults and unconformities is slow, and it becomes slower with each fault and each unconformity. Nearly all of the time goes into the faults: in a QGIS plugin model with six faults, the field of the group takes 0.01 s for 20 000 points, and the same evaluation with the faults takes 8.2 s. Each unconformity region applies the faults of its parent to the same points again, and evaluate_model does this again for each group. With 4 faults and 3 unconformities, an evaluation of all the groups makes 52 fault applications, where 4 are sufficient.

Files

  • spec.md: the spec. The user stories, in order:

    1. (P1) golden tests that freeze the present results, before any change;
    2. (P1) each fault set is applied at most once in one evaluation call, and restored points can be kept between calls with invalidation on each model change;
    3. (P2) local benchmarks with pytest-benchmark (not in CI);
    4. (P2) the same for gradients;
    5. (P3) a cheaper single fault application.

    The clarifications are answered. Only the golden results of the plugin model wait, until that model is refined.

  • research.md: the analysis of the present code (with line references for 1.11.0), the profile of the plugin model, and a baseline table for 0–4 faults and 0–3 unconformities.

  • measure_baseline.py: the script that makes the baseline table again.

🤖 Generated with Claude Code

The spec asks for golden tests and benchmarks first, then for an evaluation
that applies each fault set once in one evaluation call. research.md has
the analysis of the present code and the baseline numbers, and
measure_baseline.py makes the synthetic baseline again.
- The tolerances stay as they are.
- The real-data golden model is the plugin model, after it is refined.
- Restored points can be kept between calls, with invalidation on each
  model change, a size limit and thread safety (FR-009, FR-010, FR-010a,
  SC-010).
- The benchmarks use pytest-benchmark and run only on a developer's
  computer, not in CI.
data/plugin_model/ has the LoopStructural calls that the QGIS plugin made
(recorded from the plugin), the data of each feature, the solved field of
each interpolator, and values of the model in QGIS at 5000 points.
plugin_model.py builds the model without QGIS from these files, with the
stored fields (no solve), and gives the same values as in QGIS (difference
0). The spec and research.md record the answer to C-002, a new FR-001a
(stored fields, so that the golden results do not depend on the solver),
and what a golden model with stored fields must do.
@lachlangrose
lachlangrose merged commit 45dae3b into master Nov 1, 2026
5 of 7 checks passed
@lachlangrose
lachlangrose deleted the spec/003-fault-evaluation-performance branch November 1, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant