Skip to content

Investigate det_direct regressions for D=2..4 #158

Description

@acgetchell

Summary

det_direct() appears to have regressed for D = 2..=4, and det() may also have regressed for D = 4. Investigate the regression, identify the first bad change, and fix the determinant hot paths before v0.4.4.

Current State

  • det_direct() is the closed-form determinant path for small fixed dimensions.
  • det() should remain competitive while preserving the public error behavior introduced for determinant APIs.
  • Recent benchmark results suggest:
    • det_direct() regressed for D = 2, D = 3, and D = 4
    • det() may also have regressed for D = 4
  • Existing determinant API refactoring work for generic_const_exprs is tracked separately in Refactor determinant APIs around generic_const_exprs #123 and should not be pulled into this v0.4.4 fix unless it is necessary.

Proposed Changes

  • Reproduce the regression against the relevant baseline and current main.
  • Determine whether the slowdown comes from:
    • extra fallibility/error-path checks
    • missed inlining or const-folding
    • changed formula structure in the closed-form paths
    • fallback behavior in det() for D = 4
    • benchmark methodology or noise
  • Add or update focused benchmarks so the regression remains visible.
  • Restore the expected performance without weakening determinant correctness or public error behavior.

Benefits

  • Protects the small-dimension determinant hot paths that are central to the crate's scope.
  • Keeps v0.4.4 focused on release-train regressions.
  • Separates short-term regression repair from longer-term determinant API refactoring.

Implementation Notes

  • Compare D = 2, D = 3, and D = 4 independently; the root cause may differ by dimension.
  • Check both Matrix::det_direct() and Matrix::det().
  • Useful validation commands:
    • just bench-vs-linalg-quick det
    • cargo bench --bench vs_linalg -- det
    • cargo test
    • just check

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    debugWork involving debugging / reproductionperformancePerformance related issuesrustPull requests that update rust code

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions