Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize flow processing code #208

Open
nerdoug opened this issue Apr 15, 2023 · 0 comments
Open

Optimize flow processing code #208

nerdoug opened this issue Apr 15, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@nerdoug
Copy link
Collaborator

nerdoug commented Apr 15, 2023

Our efforts at monitoring CPU usage show that the flow processing takes a significant portion of the CPU. This may become more of an issue as additional functionality is added, especially if there's a need for quick response to events. One way to minimize the impact is to optimize the efficiency of flow processing coding, including steps like:

  • moving constant calculations out of loops
  • avoiding floating division (multiply by reciprocal instead) because the ESP32 FPU is particularly slow at division
  • unrolling loops ( although trading off for memory use isn't ideal when we're using a lot of memory at the moment)
  • reducing unproductive generality. For example, looking up the number of legs on the robot in a variable can be replaced by a macro which can be optimized by the compiler
  • using inline routines where practical, and not too expensive for memory
  • using conditionals to remove debugging and diagnostic code for "production" software
  • using integers rather than floating point when practical
@nerdoug nerdoug converted this from a draft issue Apr 15, 2023
@nerdoug nerdoug self-assigned this Apr 15, 2023
@nerdoug nerdoug added the enhancement New feature or request label Apr 15, 2023
@nerdoug nerdoug added this to the Code milestone Apr 15, 2023
@theAgingApprentice theAgingApprentice moved this to Not Started in HexaFloorRide robot Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Not Started
Development

No branches or pull requests

1 participant