Skip to content

Conversation

@baggepinnen
Copy link

@baggepinnen baggepinnen commented Sep 3, 2025

This PR

  • Makes the struct concretely typed to avoid type instability
  • Avoids the try/catch statement by simply passing an arbitrary number of arguments forward to the function k, that is, no need to use try/catch to figure out how many arguments the user-provided function has.
  • Optimizes performance by only calling function Lgh, Lfh, kd once instead of several times.

With these improvements as well as using static arrays in the segway example, the call to simulate goes from
2.000 ms (63246 allocations: 1.70 MiB)
to
104.959 μs (2218 allocations: 106.91 KiB)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant