Open martinothamar opened 2 weeks ago
Failed conditions
1 Security Hotspot
7.9% Coverage on New Code (required ≥ 45%)
0.0% Condition Coverage on New Code (required ≥ 45%)
Hmm I dont really see how tinybench is useful for real world performance testing of a webapp. Seems more focused on low level testing of functions.
Id say some of the metrics we should focus on are:
We could for example set up lighthouse CI which provides many of these metrics: https://github.com/GoogleChrome/lighthouse-ci
Could fail the build if its too slow.
Seems more focused on low level testing of functions.
Agreed, and I think we need both. We need high level testing that uses metrics focused on UX, but during the optimization process of our code we also need benchmarking that verifies that we actually optimize.
The tools you mention are good for the explorative/analysis phase where you are running one-offs and high-level before/after. Benchmarks are good for iterating on optimizations when you've chosed your place of optimization. Proper measurement of optimization requires a lot of runs/executions so that the distribution of latency can be inspected. Higher level tests where you measure metrics to capture UX quality like the ones you mention can't be run a ton of times while also having a fast feedback loop
Description
A benchmarking harness using
tinybench
as a suggestion to start tracking perf numbers. Using benchmarking provides us a paper trail - when we discover slow code that affect real usecases, we can provide benchmarks to show improvements in isolation. Upon future changes we can verify change in perf characteristics (for a variety of inputs) such asMemory allocations is missing, I couldn't find a way to correctly correlate heap changes to benchmark runs, as there might be GCs occurring in the middle of runs.
The included benchmark is a microbenchmark comparing some implementations of
splitDashedKey
that did pop up in some profiling (although this is not an issue anymore, so it serves mostly as an example).Related Issue(s)
Verification/QA
kind/*
label to this PR for proper release notes grouping