Current API for recording raw measurements requires to create a measurement, create a list of measurements and, finally, record this list - which in many cases will result in allocation of an object to queue this list.
Even when no SDK present instrumentation will allocate objects. If allocation of a Measurement can be eliminated by returning empty measurement when SDK is not present or Measure is not being aggregated by any View, creation of a list is still required.
A way to eliminate an allocation of a list, but still be able to implement batching may be to create a new class MeasuresCollection that can allow to record raw primitives - longs and doubles as a set of overridden methods with the different number of arguments.
This will also simplify API as Measurement class was causing a lot of misunderstanding and confusions. Measure can expose record method directly without the need to create another object
Current API for recording raw measurements requires to create a measurement, create a list of measurements and, finally, record this list - which in many cases will result in allocation of an object to queue this list.
Even when no SDK present instrumentation will allocate objects. If allocation of a
Measurementcan be eliminated by returning empty measurement when SDK is not present orMeasureis not being aggregated by any View, creation of a list is still required.A way to eliminate an allocation of a list, but still be able to implement batching may be to create a new class
MeasuresCollectionthat can allow torecordraw primitives - longs and doubles as a set of overridden methods with the different number of arguments.This will also simplify API as
Measurementclass was causing a lot of misunderstanding and confusions. Measure can exposerecordmethod directly without the need to create another object