Perf improvements
This PR does a lot of modernization and updates, and it also vendors critical dependencies because they were bottlenecks; I didn't want to fork them into individual repositories. The goal of those changes is to significantly reduce the overhead of prom-client and make it easier to maintain/test.
⚠ counter ➭ new is 8.628% acceptably slower.
⚠ counter ➭ inc is 4.248% acceptably slower.
✓ counter ➭ inc with labels is 60.66% faster.
⚠ gauge ➭ inc is 1.275% acceptably slower.
✓ gauge ➭ inc with labels is 112.6% faster.
✓ histogram ➭ observe#1 with 64 is 91.29% faster.
✓ histogram ➭ observe#2 with 8 is 68.05% faster.
✓ histogram ➭ observe#2 with 4 and 2 with 2 is 35.47% faster.
✓ histogram ➭ observe#2 with 2 and 2 with 4 is 34.35% faster.
✓ histogram ➭ observe#6 with 2 is 40.55% faster.
✓ histogram ➭ startTimer#1 with 64 is 23.84% faster.
✓ histogram ➭ startTimer#2 with 8 is 27.74% faster.
✓ histogram ➭ startTimer#2 with 4 and 2 with 2 is 18.38% faster.
✓ histogram ➭ startTimer#2 with 2 and 2 with 4 is 20.34% faster.
✓ histogram ➭ startTimer#6 with 2 is 25.85% faster.
✓ summary ➭ observe#1 with 64 is 61.16% faster.
✓ summary ➭ observe#2 with 8 is 56.47% faster.
✓ summary ➭ observe#2 with 4 and 2 with 2 is 26.87% faster.
✓ summary ➭ observe#2 with 2 and 2 with 4 is 28.96% faster.
✓ summary ➭ observe#6 with 2 is 41.48% faster.
✓ registry ➭ getMetricsAsJSON() no labels is 29.44% faster.
✓ registry ➭ getMetricsAsJSON() 1 x 64 is 14.81% faster.
✓ registry ➭ getMetricsAsJSON() 2 x 4 is 7.147% faster.
✓ registry ➭ getMetricsAsJSON() 2 x 8 is 12.15% faster.
✓ registry ➭ getMetricsAsJSON() 6 x 2 is 11.09% faster.
✓ registry ➭ getMetricsAsJSON() 2 x 4, 2 defaults is 13.37% faster.
✓ registry ➭ getMetricsAsJSON() 2 x 2, 4 defaults is 19.87% faster.
✓ registry ➭ metrics() no labels is 24.78% faster.
✓ registry ➭ metrics() no labels and openMetrics is 19.77% faster.
✓ registry ➭ metrics() 1 x 64 is 9.910% faster.
✓ registry ➭ metrics() 1 x 64 and openMetrics is 9.042% faster.
✓ registry ➭ metrics() 2 x 4 is 8.194% faster.
✓ registry ➭ metrics() 2 x 4 and openMetrics is 6.241% faster.
✓ registry ➭ metrics() 2 x 8 is 7.505% faster.
✓ registry ➭ metrics() 2 x 8 and openMetrics is 9.062% faster.
✓ registry ➭ metrics() 6 x 2 is 12.14% faster.
✓ registry ➭ metrics() 6 x 2 and openMetrics is 10.71% faster.
✓ registry ➭ metrics() 2 x 4, 2 defaults is 33.89% faster.
✓ registry ➭ metrics() 2 x 4, 2 defaults and openMetrics is 32.25% faster.
✓ registry ➭ metrics() 2 x 2, 4 defaults is 34.64% faster.
✓ registry ➭ metrics() 2 x 2, 4 defaults and openMetrics is 35.77% faster.
✓ cluster ➭ aggregate() is 3.535% faster.
This is amazing 😍
I'll review later today
Fixes #671
@SimenB some of those numbers are my numbers because you don’t currently bench trunk against the PR.
@jdmarshall very happy with https://github.com/siimon/prom-client/pull/728, so happy to land it so we can properly compare benchmarks before landing this one 👍
@mcollina I think if you rebase you'll get a new build.
@SimenB I think this PR is fundamentally 3 PRs and is too big to land as written. If @mcollina doesn't follow up with this before the 26th, then I will pull it down and split out the test framework changes into a separate PR, and then see if there's a good cleave line for what's left. There's just way too much going on here. 21 commits and 61 files changed.
I work on 2 other github projects that already using the nodejs test runner and a third that really should be, I think that set of changes should stand on their own. But they'll also be big enough to warrant a separate PR.
I'll do what I can to retain the provenance of the resultant commits. I'm a pretty decent git surgeon.