Skip to content

Alternative solutions #12

@ZacSweers

Description

@ZacSweers

Right now, RxDogTag is implemented via throwing an exception and capturing the stack frame at that point. While we haven't seen any measurable performance impact at a macro level, it's certainly not free either. This issue exists to capture possible alternative implementation ideas.

Bytecode transformer

Recognizes certain subscribe() signatures and re-weaves them to have the hardcoded subscribe tag present with a custom tagging observer. Cost is just a string then.

  • Pros:
    • Effectively zero runtime overhead
  • Cons:
    • Invasive
    • Potentially mangles stacktraces
    • Could impact build times
    • Unclear what API could/would be used, or if line/method/class information is available.

Compiler plugin

Recognizes certain subscribe() signatures and re-weaves them to have the hardcoded subscribe tag present with a custom tagging observer. Cost is just a string then.

  • Pros:
    • Effectively zero runtime overhead
    • Should be low-to-no overhead with build times. Cacheable as part of compilation
  • Cons:
    • Invasive
    • Potentially mangles stacktraces
    • Language-dependent
    • No formally public APIs for Java or Kotlin, just non-public ones
    • Unclear what API could/would be used, or if line/method/class

Metadata

Metadata

Assignees

No one assigned

    Labels

    PerformancePerformance implicationsdiscussionSeeking wider community input

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions