Repository navigation
Commit dbaaaf1
chore: reorganize timing.py into per-category tables, collapse test boilerplate
Reworks the ad hoc, partly-commented-out timing script (which had been
manually re-enabled with a couple of tweaks, uncommitted, sitting in
the working tree across several perf PRs this session) into something
that's actually a useful reference:
- Split into separate tables, one per category (SO(3)/SE(3) base
functions, SE3 class, quaternion base functions, UnitQuaternion
class, twist/exponential-map base functions, Twist3 class, NumPy
baseline), printed with a plain header between each. Base-level
(module functions on raw arrays) and class-level (constructors/
operators/properties on instances) are now consistently separated
throughout, rather than mixed together - the old Twist3 section in
particular had base functions (skew, trlog, trexp, rodrigues, ...)
interleaved with class-level operations.
- Fixed a corrupted docstring header left over from a bad find/replace
on upstream (`# -*- coding", t)` / `@author", t)`), unrelated to any
of this but noticed while rewriting the file.
- Fixed mislabelled/ambiguous rows: `inner()` -> `np.inner(s, s).sum()`,
bare `cross()` -> `base.cross(a, b)` (paired explicitly against
`np.cross(a, b)`), and rows comparing decomposed-(R,t) vs full-4x4
composition that had identical labels for different code paths.
- Added coverage that didn't exist before: SE3 <-> RPY, SE3 <-> Euler,
SE3 -> UnitQuaternion, UnitQuaternion <-> rotation matrix,
UnitQuaternion -> SE3, and SE3 @ SE3 (normalized compose) alongside
SE3 * SE3.
- Collapsed the `timeit.timeit(...); result(...)` two-line-per-test
boilerplate into a single `timeit(stmt, label, setup)` call (module
import aliased to `_timeit` to free up the name). Replaced the
single `timeit.timeit(..., number=N)` run per test with
`min(timeit.repeat(..., number=N, repeat=REPEATS))` - a single long
run doesn't distinguish real cost from a GC pause or OS scheduling
hiccup, min-of-repeats does. N dropped from 100_000 to 10_000 (an
arbitrary starting point either way) since the repeats now do the
work of suppressing noise that a bigger N was being used for.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 2de7801 commit dbaaaf1
1 file changed
Lines changed: 170 additions & 228 deletions
0 commit comments