Closed Swatinem closed 3 weeks ago
Adding a breadcrumb right now is using sentry__value_append_bounded to limit the number of breadcrumbs according to settings:
sentry__value_append_bounded
https://github.com/getsentry/sentry-native/blob/a05b260359246c75ccb594e86110a1fd326d04b3/src/sentry_core.c#L650-L651
However that internally does a costly memmove:
memmove
https://github.com/getsentry/sentry-native/blob/a05b260359246c75ccb594e86110a1fd326d04b3/src/sentry_value.c#L658
It would be nice to find a way to optimize this, for example by using a ringbuffer / linked list, or some other method to avoid doing a O(n) memmove every time when adding breadcrumbs that are at their maximum.
O(n)
Adding a breadcrumb right now is using
sentry__value_append_bounded
to limit the number of breadcrumbs according to settings:https://github.com/getsentry/sentry-native/blob/a05b260359246c75ccb594e86110a1fd326d04b3/src/sentry_core.c#L650-L651
However that internally does a costly
memmove
:https://github.com/getsentry/sentry-native/blob/a05b260359246c75ccb594e86110a1fd326d04b3/src/sentry_value.c#L658
It would be nice to find a way to optimize this, for example by using a ringbuffer / linked list, or some other method to avoid doing a
O(n)
memmove
every time when adding breadcrumbs that are at their maximum.