kornia/kornia-rs

[Feature]: Add Benchmarks for kornia-algebra Optimization and Lie Group Modules

Open

#698 opened on Feb 8, 2026

View on GitHub
 (7 comments) (0 reactions) (1 assignee)Rust (188 forks)auto 404
enhancementhelp wantedtriage

Repository metrics

Stars
 (675 stars)
PR merge metrics
 (PR metrics pending)

Description

🚀 Feature Description

This feature request proposes the implementation of a comprehensive benchmarking suite for the kornia-algebra crate. Specifically, it targets the newly introduced optimization module (optim) and expands the existing Lie Group benchmarks to provide comparative performance metrics against established libraries like nalgebra and sophus.

📂 Feature Category

Rust Core Library

💡 Motivation

  • Performance Tracking: Currently, there are limited benchmarks for the optimization engine. As the library grows, it is crucial to track performance regressions.
  • Comparative Analysis: To ensure kornia-rs remains a high-performance choice for computer vision in Rust, we need to baseline its geometric operations against standard ecosystems like nalgebra and sophus.
  • Optimization Validation: Developers need a way to quantitatively verify that changes to the solver (e.g., different linear system solvers, trust-region strategies) actually improve runtime performance.

💭 Proposed Solution

I propose adding the following benchmark files and updates:

  1. bench_optim.rs:
    • Implement the Rosenbrock Function as a Factor trait.
    • Use this function to benchmark the convergence speed and iteration time of the LevenbergMarquardt solver.
    • Compare execution time for fixed iteration counts.
  2. bench_lie_group.rs:
    • Add sophus as a dev-dependency to facilitate direct comparison.
    • Implement side-by-side benchmarks for:
      • SO3::exp and SO3::log.
      • SE3 composition (multiplication) and inversion.
      • Compare kornia-algebra vs nalgebra vs sophus.
  3. bench_linalg.rs:
    • Clean up existing benchmarks to ensure fair comparisons (e.g., removing redundant allocations or iterator conversions).

📚 Library Reference

The implementation will reference the following libraries and concepts:

  • Nalgebra: The standard linear algebra library in Rust for geometric types (Isometry3, UnitQuaternion).
  • Sophus: A C++ (and Rust) Lie Group library often used as a gold standard in robotics.
  • Rosenbrock Function: A non-convex function used as a performance test problem for optimization algorithms.

🔄 Alternatives Considered

No response

🎯 Use Cases

  1. CI Regression Testing: Running cargo bench in CI to detect performance drops in PRs.
  2. Solver Development: When a developer implements a new LinearSolver (e.g., sparse Cholesky), they can use bench_optim to prove its speedup on non-trivial problems.
  3. End-User Confidence: Users evaluating kornia-rs for real-time SLAM systems can see transparent performance comparisons against libraries they already know.

📝 Additional Context

No response

🤝 Contribution Intent

  • I plan to submit a PR to implement this feature
  • I'm requesting this feature but not planning to implement it

Contributor guide