Skip to content

Client.leaveBreadcrumb is slow() #1974

@pyricau

Description

@pyricau

Bug description

As measured on Square's hardware, Client.leaveBreadcrumb() is unreasonably slow (for what it's supposed to do, which is store a breadcrumb in a ring buffer).

Data

Here are the results, based on 175 measurements:

image

As you can see, the duration has a wide spread (up to 1 ms!) and the mode is around 173us. Even without the worst case scenario, that's a large amount of time for just adding an entry to a ring buffer.

I started looking into this after noticing that Client.leaveBreadcrumb() was showing up in our simpleperf traces. Anecdotally, it seemed like the time was spent in native code, through the JNI boundary.

Steps to reproduce

I measured the time it takes to call just Client.leaveBreadcrumb() as I navigated around our app with the following code:

measureTime {
  bugsnagClient.leaveBreadcrumb(message, metadata, MANUAL)
}

I speed compiled our app to ensure there's no jitting slowing things down with adb shell cmd package compile -f -m speed com.squareup.

Then I navigated a bunch in our app, which triggered the logging of breadcrumbs

Environment

  • Android version: Android Q (API 29)
  • Bugsnag version: 5.28.3
  • Physical device: Square hardware with sdm660 SOC

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogWe hope to fix this feature/bug in the futurewipThere is work in progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions