Skip to content

Commit e727237

Browse files
committed
docs: add textbook algorithm timings to benchmarks for comparison
1 parent 4b1ae0f commit e727237

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

docs/src/man/benchmarks.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ This page compares the performance of ModernRoboticsBook.jl against [Pinocchio](
88
|----------|----------------------:|---------------:|--------------------:|-------------:|
99
| Forward kinematics | 0.31 μs | **0.30 μs** | 0.86 μs | **~3x faster** |
1010
| Jacobian | 0.39 μs | **0.36 μs** | 1.0 μs | **~3x faster** |
11-
| Inverse dynamics | 3.81 μs || 0.64 μs | ~6x slower |
11+
| Inverse dynamics (RNEA) | 3.81 μs || 0.64 μs | ~6x slower |
1212
| Mass matrix (CRBA) | 1.11 μs | **0.91 μs** | 0.65 μs | ~1.4x slower |
1313
| Gravity forces | 3.80 μs || 0.48 μs | ~8x slower |
14-
| Forward dynamics | 5.38 μs || 2.82 μs | ~2x slower |
14+
| Forward dynamics (CRBA + RNEA) | 5.38 μs || 2.82 μs | ~2x slower |
15+
16+
For reference, here are the timings of the textbook algorithms that were replaced by the optimized versions above:
17+
18+
| Function (textbook algorithm) | ModernRoboticsBook.jl | Pinocchio 3.9 (C++) | vs Pinocchio |
19+
|-------------------------------|----------------------:|--------------------:|-------------:|
20+
| Mass matrix (n × RNEA) | 22.2 μs | 0.65 μs | ~34x slower |
21+
| Forward dynamics (M⁻¹ × ...) | 34.2 μs | 2.82 μs | ~12x slower |
1522

1623
*Measured on Apple M2 (16 GB), Julia 1.12, Python 3.13. Julia timings are median values from BenchmarkTools.jl.*
1724

@@ -39,7 +46,7 @@ The remaining gap in dynamics functions comes from allocation overhead in the RN
3946

4047
### When does this matter?
4148

42-
For **learning and prototyping**, ModernRoboticsBook.jl is fast enough — a full forward dynamics call takes ~34 μs, allowing ~29,000 evaluations per second. This is sufficient for trajectory optimization, offline simulation, and interactive exploration.
49+
For **learning and prototyping**, ModernRoboticsBook.jl is fast enough — a full forward dynamics call takes ~5 μs, allowing ~186,000 evaluations per second. This is sufficient for trajectory optimization, offline simulation, and interactive exploration.
4350

4451
For **real-time control loops** (1 kHz+) or **large-scale optimization** (millions of evaluations), use a production library like Pinocchio, [RigidBodyDynamics.jl](https://github.com/JuliaRobotics/RigidBodyDynamics.jl), or [MuJoCo](https://mujoco.org/).
4552

0 commit comments

Comments
 (0)