Skip to content

performance optimization: concrete impls for NumericMessage #286

@fommil

Description

@fommil

We've noticed an excessive number of Double boxings when recording histogram metrics. They land in https://github.com/DataDog/java-dogstatsd-client/blob/master/src/main/java/com/timgroup/statsd/NonBlockingStatsDClient.java#L522

which is a generic version of https://github.com/DataDog/java-dogstatsd-client/blob/master/src/main/java/com/timgroup/statsd/NumericMessage.java

The value is always boxed as a result of the Double.of call.

It would greatly reduce object allocations if there was a concrete non-generic implementation of NumericMessage for each of the types it supports (int, long and double), and then used by the histogram feature. Arguably just long and double impls should be enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions