feat(examples): add ikine_XX timing columns to ik_speed.py - #654
Merged
Conversation
Extends the existing ik_XX-only benchmark to three columns per method: the fast C-only ik_XX solver, ikine_XX with the normal C++-accelerated ETS (fkine/jacobian in C++, only the solver loop interpreted), and ikine_XX with the ETS forced onto its pure-Python fallback (both the solver loop and fkine/jacobian interpreted, as in a pure-Python wheel or Pyodide build). The pure-Python column uses a much smaller sample count (1,000 vs 10,000) since it's orders of magnitude slower per solve. Forcing the pure-Python ETS reuses the same cached ets instance rather than building a new one (robot.ets() returns a memoized instance): patch roboticstoolbox.ets.fknm._C_AVAILABLE to False and dirty the ets's _fknm cache so it rebuilds without a C++ handle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #654 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 143 143
Lines 14027 14050 +23
=====================================
- Misses 14027 14050 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
examples/ik_speed.pyfrom a singleik_XX-only benchmark to three timing columns per method:ik_XX— the existing fast, C-only solver (unchanged)ikine_XX, C++ ETS — the pure-Pythonikine_XXsolver, withfkine/jacob0evaluated via the normal C++-acceleratedETSikine_XX, pure Python ETS — the sameikine_XXsolver, but with theETSforced onto its pure-Python fallback (both the solver loop and everyfkine/jacob0call interpreted) -- what a pure-Python wheel / Pyodide build actually experiencesThe pure-Python column uses 1,000 samples instead of 10,000 -- it's orders of magnitude slower per solve (confirmed by a small dry run: LM Sugihara alone projects to ~28 minutes at 1,000 samples with this script's existing
kvalues, which I left unchanged).Forcing the pure-Python ETS path required figuring out the right lever:
robot.ets()returns a cached/memoized instance, so a freshrobot.ets()call doesn't help. Instead,roboticstoolbox.ets.fknm._C_AVAILABLEis patched toFalseand the existingets's_fknm_staleflag is set, forcing its lazily-built C++ handle to rebuild asNoneon next access -- confirmed directly thatets._fknmbecomesNoneandikine_LMstill works correctly against it.Test plan
ik_XXfastest,ikine_XX/C++ in between,ikine_XX/pure-Python orders of magnitude slower)ets._fknmisNoneafter the patch (via directreprcheck) and reverts cleanly afterwardpy_compileclean🤖 Generated with Claude Code