DataDog / datadogpy

The Datadog Python library
https://datadoghq.com/
Other
611 stars 302 forks source link

[statsd] Optimize tag normalization further #673

Closed sgnn7 closed 3 years ago

sgnn7 commented 3 years ago

Is your feature request related to a problem? Please describe.

Profiling statsd operations still points to an extremely high utilization of re.sub operations (used in normalize_tags function)

Describe the solution you'd like

Optimize normalize_tags to take less computational complexity by using the Python3 built-in @lru_cache decorator

Describe alternatives you've considered

Homebrew LRU cache can be done if we want improvements on Python2 but due to pressure to not include further dependencies and possibility of incidental problems made this a non-starter (for now).

Additional context Add any other context or screenshots about the feature request here.