metrics icon indicating copy to clipboard operation
metrics copied to clipboard

Excessive memory allocation

Open ralf0131 opened this issue 5 years ago • 1 comments

The following flame graph shows the memory allocation is beyond expectation. We should optimize it.

image

ralf0131 avatar Mar 25 '19 05:03 ralf0131

This should be fixed previously. The major allocation comes from com.alibaba.metrics.common.filter.MetricNameSetFilter#matches. To avoid string allocation, using the following logic instead.

success = name.getKey().startsWith(nameToMatch) && nameToMatch.length() == lastIndexOfDot;

ralf0131 avatar Mar 28 '19 02:03 ralf0131