Skip to content

Conversation

@julianoes
Copy link
Collaborator

When parsing messages, profiling shows that most time is spent in ostream to format the values to string.

This adds a test and a faster implementation based on std::to_chars.

@julianoes julianoes force-pushed the pr-speedup-libmav-conversion branch from 093c909 to f2c62a9 Compare November 25, 2025 03:39
@julianoes julianoes marked this pull request as ready for review November 25, 2025 04:29
@julianoes
Copy link
Collaborator Author

Alternative would be to pull in https://github.com/fmtlib/fmt.

@julianoes julianoes force-pushed the pr-speedup-libmav-conversion branch 2 times, most recently from 2e2043b to 7f1128c Compare November 25, 2025 22:59
When parsing messages, profiling shows that most time is spent in
ostream to format the values to string.

This adds a test and a faster implementation based on std::to_chars.
@julianoes julianoes force-pushed the pr-speedup-libmav-conversion branch from 7f1128c to 69f1a99 Compare November 26, 2025 03:28
@sonarqubecloud
Copy link

@julianoes
Copy link
Collaborator Author

@JonasVautherin This reduces CPU usage from 8% to 7% in a typical scenario:

  • Application on RPi5 using MavlinkDirect subscriber from 8% to 7%
  • PX4 sending MAVLink messages at a rate of 2.2kbit/s

The baseline using the C library and MavlinkPassthrough is 6%.

I'm not sure it's worth the complexity at this stage. I'd be more tempted to pull the fmt lib and use that.

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.

2 participants