status-im / nim-metrics

Nim metrics client library supporting the Prometheus monitoring toolkit, StatsD and Carbon
Other
40 stars 6 forks source link

Avoid copying redundant constant metric data on every collection #49

Closed arnetheduck closed 10 months ago

arnetheduck commented 2 years ago

Every time metrics are produced, https://github.com/status-im/nim-metrics/blob/71e0f0e354e1f4c59e3dc92153989c8b723c3440/metrics.nim#L258 copies the full registry or metrics, including help texts, metrics names etc even though this data is immutable / does not change between calls - because the data does not change, the copy could trivially be avoided.

arnetheduck commented 10 months ago

72