Cache CI expire_in parsing
Previously the CI processor spent a surprising amount of time validating the `expire_in` field for each build in the pipeline. It turns out `ChronicDuration.parse` can be expensive because it uses regular expressions and ActiveSupport numeric conversions. We observe that builds often use a small set of `expire_in` values, so we can cache the result of a previous validation. For a pipeline like `gitlab-org/gitlab` that has 200 builds with 8 different `expire_in` values, we see a 28x improvement: ``` Calculating ------------------------------------- old 1.000 i/100ms new 14.000 i/100ms ------------------------------------------------- old 5.275 (± 0.0%) i/s - 27.000 new 149.409 (± 5.4%) i/s - 756.000 Comparison: new: 149.4 i/s old: 5.3 i/s - 28.32x slower ``` Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/322386 Changelog: performance
Showing
Please register or sign in to comment