@maverickcer/env-cap 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADOPTION.md +144 -0
- package/AGENTS.md +146 -0
- package/CHANGELOG.md +438 -0
- package/CODE_OF_CONDUCT.md +124 -0
- package/CODE_REVIEW.md +200 -0
- package/CONTRIBUTING.md +131 -0
- package/GUIDE.md +1214 -0
- package/PROMPT.md +89 -0
- package/README.md +92 -200
- package/RELEASING.md +160 -0
- package/SECURITY.md +270 -0
- package/SUPPORT.md +76 -0
- package/VERSIONING.md +118 -0
- package/benchmarks/READING-BENCHMARKS.md +197 -0
- package/benchmarks/README.md +126 -0
- package/benchmarks/WRITING-BENCHMARKS.md +252 -0
- package/benchmarks/performance-buildtime/BENCHMARKS.md +889 -0
- package/benchmarks/performance-runtime/BENCHMARKS.md +1988 -0
- package/dist/.dts/_ipc/build-fs.d.ts +53 -0
- package/dist/.dts/_ipc/build-fs.d.ts.map +1 -0
- package/dist/.dts/_ipc/compiler-api.d.ts +17 -0
- package/dist/.dts/_ipc/compiler-api.d.ts.map +1 -0
- package/dist/.dts/_ipc/display-path.d.ts +27 -0
- package/dist/.dts/_ipc/display-path.d.ts.map +1 -0
- package/dist/.dts/_ipc/generated-banner.d.ts +58 -0
- package/dist/.dts/_ipc/generated-banner.d.ts.map +1 -0
- package/dist/.dts/_ipc/glob.d.ts +22 -0
- package/dist/.dts/_ipc/glob.d.ts.map +1 -0
- package/dist/.dts/_ipc/no-node-fs.d.ts +34 -0
- package/dist/.dts/_ipc/no-node-fs.d.ts.map +1 -0
- package/dist/.dts/_ipc/resolve-tsconfig-paths.d.ts +134 -0
- package/dist/.dts/_ipc/resolve-tsconfig-paths.d.ts.map +1 -0
- package/dist/.dts/_ipc/typescript.d.ts +20 -0
- package/dist/.dts/_ipc/typescript.d.ts.map +1 -0
- package/dist/.dts/build/compatibility.d.ts.map +1 -1
- package/dist/.dts/build/compiler-api.d.ts +3 -6
- package/dist/.dts/build/compiler-api.d.ts.map +1 -1
- package/dist/.dts/build/display-path.d.ts +3 -21
- package/dist/.dts/build/display-path.d.ts.map +1 -1
- package/dist/.dts/build/generated-banner.d.ts +21 -42
- package/dist/.dts/build/generated-banner.d.ts.map +1 -1
- package/dist/.dts/build/glob.d.ts +3 -15
- package/dist/.dts/build/glob.d.ts.map +1 -1
- package/dist/.dts/build/link.d.ts.map +1 -1
- package/dist/.dts/build/merge-documentation.d.ts +35 -0
- package/dist/.dts/build/merge-documentation.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts +11 -112
- package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts.map +1 -1
- package/dist/.dts/build/types.d.ts +4 -53
- package/dist/.dts/build/types.d.ts.map +1 -1
- package/dist/.dts/build/typescript.d.ts +3 -17
- package/dist/.dts/build/typescript.d.ts.map +1 -1
- package/dist/.dts/eslint-plugin/glob.d.ts +4 -15
- package/dist/.dts/eslint-plugin/glob.d.ts.map +1 -1
- package/dist/.dts/eslint-plugin/index.d.ts +1 -1
- package/dist/.dts/eslint-plugin/no-node-fs.d.ts +8 -18
- package/dist/.dts/eslint-plugin/no-node-fs.d.ts.map +1 -1
- package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts.map +1 -1
- package/dist/{build-H4KFV44Z.js → build-WKDIAWF7.js} +198 -60
- package/dist/build-WKDIAWF7.js.map +1 -0
- package/dist/build.cjs +194 -56
- package/dist/build.cjs.map +1 -1
- package/dist/build.js +194 -56
- package/dist/build.js.map +1 -1
- package/dist/{chunk-7GVPOHDU.js → chunk-KEGYUHBU.js} +2 -2
- package/dist/cli/index.js +36 -29
- package/dist/cli/index.js.map +1 -1
- package/dist/eslint-plugin/index.cjs +84 -54
- package/dist/eslint-plugin/index.cjs.map +1 -1
- package/dist/eslint-plugin/index.js +83 -53
- package/dist/eslint-plugin/index.js.map +1 -1
- package/examples/README.md +95 -0
- package/package.json +48 -14
- package/skills/env-cap/SKILL.md +91 -0
- package/skills/env-cap/references/api.md +220 -0
- package/specs/architecture.md +634 -0
- package/specs/decisions/0001-runtime-documentation-separation.md +197 -0
- package/specs/decisions/0002-static-analysis-never-execution.md +233 -0
- package/specs/decisions/0003-no-global-env-object.md +172 -0
- package/specs/decisions/0004-no-client-server-package-split.md +116 -0
- package/specs/decisions/0005-warn-not-throw-by-default.md +93 -0
- package/specs/decisions/0006-self-redacting-contracts.md +124 -0
- package/specs/decisions/0007-processor-not-transformer.md +109 -0
- package/specs/decisions/0008-gzip-size-budget.md +173 -0
- package/specs/decisions/0009-exclusive-groups-are-always-errors.md +139 -0
- package/specs/decisions/0010-dependency-ownership-engine-scope-boundary.md +100 -0
- package/specs/decisions/0011-shared-discovery-compute-atomic-write-non-atomic.md +104 -0
- package/specs/decisions/0012-live-expiration-overrides-not-ast-functions.md +145 -0
- package/specs/decisions/0013-json-output-is-a-versioned-mirror.md +136 -0
- package/specs/decisions/0014-cross-package-schema-discovery.md +206 -0
- package/specs/decisions/0015-security-backport-window.md +60 -0
- package/specs/decisions/0016-check-mode-compute-before-compare-never-partial-write.md +113 -0
- package/specs/decisions/0017-eslint-plugin-entry-point.md +113 -0
- package/specs/decisions/0018-rotation-alert-issue-on-non-pr-runs.md +104 -0
- package/specs/decisions/0019-published-json-schema-generated-from-types.md +100 -0
- package/specs/decisions/0020-declaration-maps-via-separate-tsc-pass.md +101 -0
- package/specs/decisions/0021-manifest-change-report-persisted-snapshot.md +177 -0
- package/specs/decisions/0022-validation-contexts.md +267 -0
- package/specs/decisions/0023-tsconfig-path-alias-resolution.md +182 -0
- package/specs/decisions/0024-fact-model-architecture.md +144 -0
- package/specs/decisions/0025-contract-model-json-projection.md +105 -0
- package/specs/decisions/0026-finding-model-unifies-four-families.md +109 -0
- package/specs/decisions/0027-dependency-model-fact-shape-not-engine-access.md +98 -0
- package/specs/decisions/0028-ownership-model-shared-effective-owner.md +85 -0
- package/specs/decisions/0029-lifecycle-model-deprecation-rename-fields.md +98 -0
- package/specs/decisions/0030-change-model-wraps-manifest-change-report.md +97 -0
- package/specs/decisions/0031-evidence-entry-point.md +85 -0
- package/specs/decisions/0032-evidence-projection-provenance-mechanism.md +120 -0
- package/specs/decisions/0033-reference-projections-live-in-examples.md +81 -0
- package/specs/decisions/0034-three-tier-examples-restructuring.md +85 -0
- package/specs/decisions/0035-documentenv-metadata-generalization-and-compliance-fields.md +85 -0
- package/specs/decisions/0036-exact-source-position-evidence.md +122 -0
- package/specs/decisions/0037-developer-declared-dynamic-access-citations.md +114 -0
- package/specs/decisions/0038-always-computed-evidence-model-backs-generate-check-docs.md +244 -0
- package/specs/decisions/0039-scanner-local-dataflow-boundary.md +160 -0
- package/specs/decisions/0040-library-surfaces-do-not-acquire-node-fs.md +156 -0
- package/specs/decisions/0041-dual-package-hazard-checked-documented.md +75 -0
- package/specs/decisions/0042-init-cli-subcommand-scaffolds-only.md +95 -0
- package/specs/decisions/0043-env-cap-resolver-relocated-and-duplicated.md +71 -0
- package/specs/decisions/0044-strict-escalates-every-warning-family.md +88 -0
- package/specs/decisions/0045-promote-experimental-surfaces-to-stable.md +103 -0
- package/specs/decisions/0046-cli-restricted-to-runtime-and-evidence-output.md +177 -0
- package/specs/decisions/0047-supported-toolchain-node-22-and-typescript-5-6.md +30 -0
- package/specs/decisions/0048-eslint-plugin-does-not-vendor-typescript-eslint.md +25 -0
- package/specs/decisions/0049-typescript-7-scanner-uses-a-bundled-typescript-6.md +87 -0
- package/specs/decisions/0050-a-variable-declared-twice-is-documented-once.md +55 -0
- package/specs/generated-artifacts.md +104 -0
- package/specs/migrations/README.md +30 -0
- package/specs/migrations/from-centralized-schema.md +503 -0
- package/specs/migrations/from-dotenv.md +352 -0
- package/specs/migrations/from-envalid.md +482 -0
- package/specs/migrations/from-process-env.md +398 -0
- package/specs/migrations/from-t3-env.md +416 -0
- package/specs/migrations/from-zod.md +303 -0
- package/dist/build-H4KFV44Z.js.map +0 -1
- /package/dist/{chunk-7GVPOHDU.js.map → chunk-KEGYUHBU.js.map} +0 -0
|
@@ -0,0 +1,1988 @@
|
|
|
1
|
+
# env-cap: performance and cost report
|
|
2
|
+
|
|
3
|
+
What does adopting this package add to latency, CPU, memory and compute spend -- and how does that grow with workload? Three views, from the whole to the part: **(1)** the end-to-end total, **(2)** every function on its own, **(3)** which functions make up the total. New to benchmarks? Read [READING-BENCHMARKS.md](../READING-BENCHMARKS.md) first.
|
|
4
|
+
|
|
5
|
+
## What adopting this package costs
|
|
6
|
+
|
|
7
|
+
For a typical workload of **640 variables** per operation, routing the work through `env-cap` adds **187 µs** per operation compared with a bare-minimum baseline (**250% of the baseline**). Overall, it grows O(n) with workload size (measured exponent 0.76). At list prices that is on the order of **~$0.001 – $0.01 per million operations** of compute.
|
|
8
|
+
|
|
9
|
+
> The relative figure and the growth class are the steadier ones: both come from the same run, so they depend far less on the machine than a time does, though runtime behaviour and contention on the runner still move them. The growth class is an empirical fit to the sizes tested, not a proof of asymptotic complexity. Dollar figures are **order-of-magnitude** estimates from published list prices on shared hardware (see _Cost model_ below) -- good for comparing one package with another, not for budgeting.
|
|
10
|
+
|
|
11
|
+
| Cost | Typical (640 variables) | Largest (10240 variables) |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| Added latency per operation | 187 µs | 545 µs |
|
|
14
|
+
| Added latency, relative to baseline | 250% | 39% |
|
|
15
|
+
| Added CPU time per operation | 726 µs | 1.00 µs |
|
|
16
|
+
| Added memory per operation (heap delta) | 330.4 KiB | 359.2 KiB |
|
|
17
|
+
| Compute cost per 1M operations (order of magnitude) | ~$0.001 – $0.01 | ~$0.00001 – $0.001 |
|
|
18
|
+
| Single-core throughput ceiling of the overhead alone | 5,346 ops/s | 1,833 ops/s |
|
|
19
|
+
| Shipped code parsed at every cold start (gzip) | 5.6 KiB | 5.6 KiB |
|
|
20
|
+
|
|
21
|
+
## 1. End-to-end: the package's total impact
|
|
22
|
+
|
|
23
|
+
Shows what a service pays at startup, per validation, for declaring its environment through env-cap instead of reading values by hand. Both sides handle the same n values from an in-memory source and finish knowing every value is present and usable; the only difference is env-cap's contract machinery (schema walk, processor and validator dispatch, error collection). This is the floor: real variables add their own processors and validators on top (measured per helper below), and real startup is dominated by the platform, not by this.
|
|
24
|
+
|
|
25
|
+
- **Baseline (no package):** A loop reads each of n values from a plain object and stores it in a result object -- no env-cap.
|
|
26
|
+
- **With the package:** `validateEnv` checks the same n values against a contract of n variables with identity processors.
|
|
27
|
+
|
|
28
|
+
Both sides use empty or minimal functions on purpose, so the difference is the package's own cost -- not the cost of the work an application would plug into it. Real applications add their own work on top; this is the floor the package imposes.
|
|
29
|
+
|
|
30
|
+
**Variables that could change this result**
|
|
31
|
+
|
|
32
|
+
| Variable | How it is handled | What it is |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| variables | swept | The tier axis: how many environment variables are declared and validated. |
|
|
35
|
+
| variable declaration | fixed at "identity processor, no validator" | Variables use the cheapest possible processor so the measurement is env-cap's own machinery; processor and validator cost is measured per helper below. |
|
|
36
|
+
| value source | fixed at "an in-memory object of short strings" | Real environments read process.env, which behaves like an object of strings; reading it is not env-cap's cost. |
|
|
37
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
38
|
+
| contract count | fixed at 1 | All variables live in one contract; splitting them across contracts adds a small constant per contract. |
|
|
39
|
+
| validity | fixed at "every value valid" | The success path; failures add error-object construction and are cheaper to reach but costlier to report. |
|
|
40
|
+
|
|
41
|
+
The baseline is an empty or minimal function, so it costs almost nothing and the _relative_ overhead can look enormous (shown as a multiple of the baseline). Read the absolute columns -- time, CPU and dollars added -- they are what a bill and a latency budget are made of.
|
|
42
|
+
|
|
43
|
+
| variables | Baseline | With package | Added | Added vs baseline | Added CPU | Est. $ / 1M ops |
|
|
44
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
45
|
+
| 20 | 0.789 µs | 19.8 µs | 19.0 µs | 25× baseline | 22.1 µs | $0.00004 – $0.00025 |
|
|
46
|
+
| 40 | 1.64 µs | 25.9 µs | 24.3 µs | 16× baseline | 23.7 µs | $0.000051 – $0.00027 |
|
|
47
|
+
| 80 | 3.34 µs | 38.8 µs | 35.4 µs | 12× baseline | 30.2 µs | $0.000074 – $0.00034 |
|
|
48
|
+
| 160 | 7.58 µs | 67.0 µs | 59.4 µs | 784% | 46.4 µs | $0.00012 – $0.00052 |
|
|
49
|
+
| 320 | 23.1 µs | 132 µs | 109 µs | 470% | 73.8 µs | $0.00023 – $0.00083 |
|
|
50
|
+
| 640 | 74.8 µs | 262 µs | 187 µs | 250% | 726 µs | $0.00039 – $0.0082 |
|
|
51
|
+
| 1280 | 85.0 µs | 264 µs | 179 µs | 210% | 712 µs | $0.00037 – $0.008 |
|
|
52
|
+
| 2560 | 255 µs | 452 µs | 197 µs | 77% | 643 µs | $0.00041 – $0.0072 |
|
|
53
|
+
| 5120 | 623 µs | 965 µs | 342 µs | 55% | 836 µs | $0.00071 – $0.0094 |
|
|
54
|
+
| 10240 | 1.38 ms | 1.93 ms | 545 µs | 39% | 1.00 µs | $0.000011 – $0.0011 |
|
|
55
|
+
|
|
56
|
+
**How the total grows:** O(n) (linear), exponent 0.76 over 10 sizes.
|
|
57
|
+
|
|
58
|
+
## 2. Function by function
|
|
59
|
+
|
|
60
|
+
Every function the package exposes is measured on its own across the full size ladder, then its measured growth rate is compared with the big-O we documented for it. A function whose measured class **differs** from its documented one is the most useful thing in this report: either the documentation or the code is wrong.
|
|
61
|
+
|
|
62
|
+
| Function | Varies | Documented | Measured | Agreement | At 640 | At 10240 |
|
|
63
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
64
|
+
| `process start with n variables declared (cold start)` | variable | O(n) | O(log n) | 🟡 close (neighbouring class) | 45.2 ms | 232 ms |
|
|
65
|
+
| `createEnv (declare a contract)` | variable | O(n) | n/a | ❔ not enough data | 185 µs | 4.32 ms |
|
|
66
|
+
| `validateEnv (validate n values)` | variable | O(n) | O(n) | ✅ matches | 281 µs | 2.07 ms |
|
|
67
|
+
| `validateEnv (validate n values)` | variables-per-contract | O(1) | n/a | ❔ not enough data | n/a | n/a |
|
|
68
|
+
| `processors.base64()` | variable | O(n) | n/a | ❔ not enough data | 0.468 µs | 1.34 µs |
|
|
69
|
+
| `processors.parseJSON()` | variable | O(n) | O(n) | ✅ matches | 80.1 µs | 1.65 ms |
|
|
70
|
+
| `processors.split(",")` | variable | O(n) | O(n) | ✅ matches | 12.2 µs | 202 µs |
|
|
71
|
+
| `processors.toArray(",", [trim()])` | variable | O(n) | O(n) | ✅ matches | 60.2 µs | 693 µs |
|
|
72
|
+
| `processors.toBigInt()` | variable | O(n²) | O(n log n) | 🟡 close (neighbouring class) | 1.86 µs | 146 µs |
|
|
73
|
+
| `processors.toBoolean()` | variable | O(1) | O(1) | ✅ matches | 0.102 µs | 0.102 µs |
|
|
74
|
+
| `processors.toDate()` | variable | O(1) | O(1) | ✅ matches | 0.319 µs | 0.312 µs |
|
|
75
|
+
| `processors.toInteger()` | variable | O(1) | O(1) | ✅ matches | 0.0869 µs | 0.0827 µs |
|
|
76
|
+
| `processors.toLowerCase()` | variable | O(n) | O(n) | ✅ matches | 0.177 µs | 1.20 µs |
|
|
77
|
+
| `processors.toNumber()` | variable | O(1) | O(1) | ✅ matches | 0.0817 µs | 0.0818 µs |
|
|
78
|
+
| `processors.toRegExp()` | variable | O(n) | O(n) | ✅ matches | 0.998 µs | 8.50 µs |
|
|
79
|
+
| `processors.toString()` | variable | O(1) | O(1) | ✅ matches | 0.0862 µs | 0.0813 µs |
|
|
80
|
+
| `processors.toURL()` | variable | O(n) | O(log n) | 🟡 close (neighbouring class) | 0.794 µs | 4.26 µs |
|
|
81
|
+
| `processors.toUpperCase()` | variable | O(n) | O(n) | ✅ matches | 0.182 µs | 1.38 µs |
|
|
82
|
+
| `processors.trim()` | variable | O(n) | O(n) | ✅ matches | 1.04 µs | 12.5 µs |
|
|
83
|
+
| `validators.after(date)` | variable | O(1) | O(1) | ✅ matches | 0.186 µs | 0.182 µs |
|
|
84
|
+
| `validators.all(...validators)` | variable | O(n) | O(n) | ✅ matches | 1.39 µs | 20.9 µs |
|
|
85
|
+
| `validators.any(...validators)` | variable | O(n) | O(n) | ✅ matches | 8.81 µs | 138 µs |
|
|
86
|
+
| `validators.before(date)` | variable | O(1) | O(1) | ✅ matches | 0.181 µs | 0.189 µs |
|
|
87
|
+
| `validators.custom(fn)` | variable | O(1) | O(1) | ✅ matches | 0.0655 µs | 0.0660 µs |
|
|
88
|
+
| `validators.email()` | variable | O(n) | O(n) | ✅ matches | 0.941 µs | 6.24 µs |
|
|
89
|
+
| `validators.endsWith(suffix)` | variable | O(1) | O(1) | ✅ matches | 0.0886 µs | 0.0951 µs |
|
|
90
|
+
| `validators.finite()` | variable | O(1) | O(1) | ✅ matches | 0.0694 µs | 0.0710 µs |
|
|
91
|
+
| `validators.future()` | variable | O(1) | O(1) | ✅ matches | 0.272 µs | 0.272 µs |
|
|
92
|
+
| `validators.includes(text)` | variable | O(1) | O(1) | ✅ matches | 0.0951 µs | 0.146 µs |
|
|
93
|
+
| `validators.integer()` | variable | O(1) | O(1) | ✅ matches | 0.0698 µs | 0.0720 µs |
|
|
94
|
+
| `validators.length(n)` | variable | O(1) | O(1) | ✅ matches | 0.0702 µs | 0.0706 µs |
|
|
95
|
+
| `validators.matches(regex)` | variable | O(n) | O(n) | ✅ matches | 0.498 µs | 3.76 µs |
|
|
96
|
+
| `validators.max(limit)` | variable | O(1) | O(1) | ✅ matches | 0.0703 µs | 0.0707 µs |
|
|
97
|
+
| `validators.maxItems(limit)` | variable | O(1) | O(1) | ✅ matches | 0.0709 µs | 0.0699 µs |
|
|
98
|
+
| `validators.maxLength(limit)` | variable | O(1) | O(1) | ✅ matches | 0.0699 µs | 0.0702 µs |
|
|
99
|
+
| `validators.min(limit)` | variable | O(1) | O(1) | ✅ matches | 0.0701 µs | 0.0699 µs |
|
|
100
|
+
| `validators.minItems(limit)` | variable | O(1) | O(1) | ✅ matches | 0.0709 µs | 0.0695 µs |
|
|
101
|
+
| `validators.minLength(limit)` | variable | O(1) | n/a | ❔ not enough data | 0.0698 µs | 0.0715 µs |
|
|
102
|
+
| `validators.negative()` | variable | O(1) | O(1) | ✅ matches | 0.0705 µs | 0.0702 µs |
|
|
103
|
+
| `validators.not(validator)` | variable | O(1) | O(1) | ✅ matches | 0.0850 µs | 0.0707 µs |
|
|
104
|
+
| `validators.oneOf(options)` | variable | O(n) | O(n) | ✅ matches | 1.45 µs | 10.2 µs |
|
|
105
|
+
| `validators.optional(validator)` | variable | O(1) | O(1) | ✅ matches | 0.0705 µs | 0.0709 µs |
|
|
106
|
+
| `validators.past()` | variable | O(1) | O(1) | ✅ matches | 0.274 µs | 0.275 µs |
|
|
107
|
+
| `validators.positive()` | variable | O(1) | O(1) | ✅ matches | 0.0708 µs | 0.0722 µs |
|
|
108
|
+
| `validators.range(min, max)` | variable | O(1) | O(1) | ✅ matches | 0.0706 µs | 0.0707 µs |
|
|
109
|
+
| `validators.refine(validator, message)` | variable | O(1) | O(1) | ✅ matches | 0.0722 µs | 0.0706 µs |
|
|
110
|
+
| `validators.required()` | variable | O(1) | O(1) | ✅ matches | 0.0712 µs | 0.0719 µs |
|
|
111
|
+
| `validators.safeInteger()` | variable | O(1) | O(1) | ✅ matches | 0.0707 µs | 0.0702 µs |
|
|
112
|
+
| `validators.unique()` | variable | O(n) | O(n log n) | 🟡 close (neighbouring class) | 11.0 µs | 396 µs |
|
|
113
|
+
| `validators.url()` | variable | O(n) | O(log n) | 🟡 close (neighbouring class) | 0.733 µs | 3.91 µs |
|
|
114
|
+
| `validators.uuid()` | variable | O(1) | O(1) | ✅ matches | 0.243 µs | 0.247 µs |
|
|
115
|
+
| `validators.uuidVersion(v)` | variable | O(1) | O(1) | ✅ matches | 0.243 µs | 0.242 µs |
|
|
116
|
+
|
|
117
|
+
> **Could not be determined.** The big-O of these could not be measured, so they are not checked against their documentation:
|
|
118
|
+
>
|
|
119
|
+
> - `create-env` (varying variable): over the largest 10 variable sizes the timings do not follow one growth rate (R² 0.68, and a fit below 0.8 is not trusted; fitted exponent 0.96). The cost probably changes regime between sizes (a cache, a threshold, a batch size) or run-to-run noise outweighs the growth
|
|
120
|
+
> - `processor-base64` (varying variable): over the largest 10 variable sizes the timings do not follow one growth rate (R² 0.70, and a fit below 0.8 is not trusted; fitted exponent 0.33). The cost probably changes regime between sizes (a cache, a threshold, a batch size) or run-to-run noise outweighs the growth
|
|
121
|
+
> - `validator-min-length` (varying variable): over the largest 10 variable sizes the timings do not follow one growth rate (R² 0.10, and a fit below 0.8 is not trusted; fitted exponent -0.07). The cost probably changes regime between sizes (a cache, a threshold, a batch size) or run-to-run noise outweighs the growth
|
|
122
|
+
|
|
123
|
+
### `process start with n variables declared (cold start)`
|
|
124
|
+
|
|
125
|
+
**Why we benchmark it.** Every process that imports its environment contracts pays this before serving its first request: each deploy, each serverless cold start, each CLI run and each test worker. It is where env-cap's cost is most visible to an operator.
|
|
126
|
+
|
|
127
|
+
**What poor performance would mean.** Slower deploys and a longer first request on every new instance; on serverless platforms the delay is billed on every scale-from-zero. A super-linear regression would make large configurations noticeably slow to boot.
|
|
128
|
+
|
|
129
|
+
**Expected growth: O(n).** Importing the contracts evaluates one `createEnv` per contract, and `validateEnv` then walks every variable once, so after Node's own start-up floor the time grows in proportion to the number of variables.
|
|
130
|
+
|
|
131
|
+
**Variables that could change its cost**
|
|
132
|
+
|
|
133
|
+
| Variable | How it is handled | What it is |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| variables | swept | The tier axis: how many environment variables are declared and validated. |
|
|
136
|
+
| process start-up floor | fixed at "one fresh Node process per sample" | Node's own start-up time is included and sets the flat floor of the curve. |
|
|
137
|
+
| variables per contract | fixed at 10 | Contracts of ten variables, so the contract count grows with n; a few large contracts versus many small ones is not swept. |
|
|
138
|
+
| variable declaration | fixed at "identity processor, no validator" | Variables use the cheapest possible processor so the measurement is env-cap's own machinery; processor and validator cost is measured per helper below. |
|
|
139
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
140
|
+
|
|
141
|
+
**Deliberately not covered**
|
|
142
|
+
|
|
143
|
+
- **warm module cache** -- A fresh process has no warm cache by definition.
|
|
144
|
+
- **bundled loading** -- Measured through Node's native ESM loader; bundlers change module-evaluation cost and are application-specific.
|
|
145
|
+
|
|
146
|
+
**Measured: O(log n)** (exponent 0.59, 10 sizes) -- 🟡 close (neighbouring class).
|
|
147
|
+
|
|
148
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
149
|
+
| --- | --- | --- | --- | --- | --- |
|
|
150
|
+
| 20 | 30.5 ms | 30.7 ms | 1.93 ms | 156.3 KiB | 33 |
|
|
151
|
+
| 40 | 31.7 ms | 34.4 ms | 2.03 ms | 155.5 KiB | 32 |
|
|
152
|
+
| 80 | 35.5 ms | 36.7 ms | 2.04 ms | 153.1 KiB | 28 |
|
|
153
|
+
| 160 | 34.6 ms | 35.7 ms | 1.95 ms | 153.1 KiB | 29 |
|
|
154
|
+
| 320 | 39.6 ms | 41.1 ms | 2.03 ms | 153.0 KiB | 25 |
|
|
155
|
+
| 640 | 45.2 ms | 46.6 ms | 2.06 ms | 153.1 KiB | 22 |
|
|
156
|
+
| 1280 | 59.3 ms | 62.6 ms | 2.15 ms | 152.7 KiB | 17 |
|
|
157
|
+
| 2560 | 91.0 ms | 97.0 ms | 2.31 ms | 152.8 KiB | 11 |
|
|
158
|
+
| 5120 | 131 ms | 136 ms | 2.26 ms | 152.7 KiB | 8 |
|
|
159
|
+
| 10240 | 232 ms | 234 ms | 2.17 ms | 152.7 KiB | 4 |
|
|
160
|
+
|
|
161
|
+
### `createEnv (declare a contract)`
|
|
162
|
+
|
|
163
|
+
**Why we benchmark it.** Runs once per contract when its module is imported, so it is the per-contract part of cold start and the cost of every contract an application declares.
|
|
164
|
+
|
|
165
|
+
**What poor performance would mean.** Slower boot in proportion to the size of the configuration; for an application with hundreds of variables the cost lands on every process start.
|
|
166
|
+
|
|
167
|
+
**Expected growth: O(n).** It walks the schema once to freeze and register each variable definition, so cost is proportional to the number of variables.
|
|
168
|
+
|
|
169
|
+
**Variables that could change its cost**
|
|
170
|
+
|
|
171
|
+
| Variable | How it is handled | What it is |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| variables | swept | The tier axis: how many environment variables are declared and validated. |
|
|
174
|
+
| variable declaration | fixed at "identity processor, no validator" | Variables use the cheapest possible processor so the measurement is env-cap's own machinery; processor and validator cost is measured per helper below. |
|
|
175
|
+
| contract naming | fixed at "unique name per call" | Each call registers a new contract name; reusing a name takes a different (error) path. |
|
|
176
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
177
|
+
|
|
178
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
179
|
+
| --- | --- | --- | --- | --- | --- |
|
|
180
|
+
| 20 | 5.55 µs | 6.00 µs | 21.7 µs | 7.7 KiB | 180,047 |
|
|
181
|
+
| 40 | 9.06 µs | 10.0 µs | 34.6 µs | 11.3 KiB | 110,424 |
|
|
182
|
+
| 80 | 13.3 µs | 13.8 µs | 36.1 µs | 21.4 KiB | 75,269 |
|
|
183
|
+
| 160 | 25.7 µs | 26.9 µs | 62.8 µs | 42.0 KiB | 38,873 |
|
|
184
|
+
| 320 | 58.9 µs | 60.5 µs | 125 µs | 84.4 KiB | 16,964 |
|
|
185
|
+
| 640 | 185 µs | 188 µs | 293 µs | 173.1 KiB | 5,417 |
|
|
186
|
+
| 1280 | 2.32 ms | 2.40 ms | 3.17 ms | 482.1 KiB | 431 |
|
|
187
|
+
| 2560 | 2.52 ms | 2.63 ms | 3.42 ms | 901.0 KiB | 397 |
|
|
188
|
+
| 5120 | 3.25 ms | 3.54 ms | 4.11 ms | 1.5 MiB | 308 |
|
|
189
|
+
| 10240 | 4.32 ms | 4.64 ms | 5.32 ms | 2.7 MiB | 231 |
|
|
190
|
+
|
|
191
|
+
### `validateEnv (validate n values)`
|
|
192
|
+
|
|
193
|
+
**Why we benchmark it.** The startup check itself: every variable's value is processed and validated, once per process. It is the dominant steady-state cost env-cap adds.
|
|
194
|
+
|
|
195
|
+
**What poor performance would mean.** Every process start pays the slowdown, and so does every test run that validates configuration; a quadratic regression would make large configurations unusable.
|
|
196
|
+
|
|
197
|
+
**Expected growth: O(n).** It visits each declared variable once, runs its processor and validator and records the outcome, so cost is proportional to the number of variables.
|
|
198
|
+
|
|
199
|
+
**Variables that could change its cost**
|
|
200
|
+
|
|
201
|
+
| Variable | How it is handled | What it is |
|
|
202
|
+
| --- | --- | --- |
|
|
203
|
+
| variables | swept | The tier axis: how many environment variables are declared and validated. |
|
|
204
|
+
| variables-per-contract | swept | How many variables each contract declares (ten in the main sweep). With the total fixed, a few large contracts or many small ones cost differently: per-contract work against per-variable work. |
|
|
205
|
+
| variable declaration | fixed at "identity processor, no validator" | Variables use the cheapest possible processor so the measurement is env-cap's own machinery; processor and validator cost is measured per helper below. |
|
|
206
|
+
| value source | fixed at "an in-memory object of short strings" | Real environments read process.env, which behaves like an object of strings; reading it is not env-cap's cost. |
|
|
207
|
+
| validation cache | fixed at "reset before every sample" | `validateEnv` is idempotent for the life of a process, so a repeat call is a free cache hit; each sample starts from an empty cache to measure the real validation. |
|
|
208
|
+
| validity | fixed at "every value valid" | The success path. |
|
|
209
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
210
|
+
|
|
211
|
+
**In the end-to-end run:** This is the end-to-end operation itself.
|
|
212
|
+
|
|
213
|
+
**Measured: O(n)** (exponent 0.77, 10 sizes) -- ✅ matches.
|
|
214
|
+
|
|
215
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
216
|
+
| --- | --- | --- | --- | --- | --- |
|
|
217
|
+
| 20 | 20.8 µs | 27.1 µs | 23.0 µs | 5.4 KiB | 48,075 |
|
|
218
|
+
| 40 | 27.5 µs | 44.2 µs | 29.0 µs | 8.2 KiB | 36,376 |
|
|
219
|
+
| 80 | 40.5 µs | 57.2 µs | 43.0 µs | 17.7 KiB | 24,703 |
|
|
220
|
+
| 160 | 69.7 µs | 83.8 µs | 72.0 µs | 47.8 KiB | 14,344 |
|
|
221
|
+
| 320 | 137 µs | 151 µs | 140 µs | 160.5 KiB | 7,312 |
|
|
222
|
+
| 640 | 281 µs | 311 µs | 959 µs | 584.8 KiB | 3,556 |
|
|
223
|
+
| 1280 | 281 µs | 321 µs | 977 µs | 174.8 KiB | 3,558 |
|
|
224
|
+
| 2560 | 475 µs | 637 µs | 1.18 ms | 398.7 KiB | 2,105 |
|
|
225
|
+
| 5120 | 1.06 ms | 1.42 ms | 1.96 ms | 691.3 KiB | 944 |
|
|
226
|
+
| 10240 | 2.07 ms | 3.01 ms | 2.85 ms | 1.3 MiB | 483 |
|
|
227
|
+
|
|
228
|
+
##### Varying `variables-per-contract`
|
|
229
|
+
|
|
230
|
+
How many variables each contract declares (ten in the main sweep). With the total fixed, a few large contracts or many small ones cost differently: per-contract work against per-variable work.
|
|
231
|
+
|
|
232
|
+
**Expected: O(1).** The same total number of variables is validated however they are split across contracts; each contract adds one lookup, a share that shrinks as contracts grow.
|
|
233
|
+
|
|
234
|
+
### `processors.base64()`
|
|
235
|
+
|
|
236
|
+
**Why we benchmark it.** Decodes a base64-encoded secret or certificate into its original text. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
237
|
+
|
|
238
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.base64(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
239
|
+
|
|
240
|
+
**Expected growth: O(n).** Decoding reads each encoded character once and writes the decoded bytes, so the work is proportional to the length of the encoded value.
|
|
241
|
+
|
|
242
|
+
**Variables that could change its cost**
|
|
243
|
+
|
|
244
|
+
| Variable | How it is handled | What it is |
|
|
245
|
+
| --- | --- | --- |
|
|
246
|
+
| input size | swept | Length of the base64 text, in characters. |
|
|
247
|
+
| input content | fixed at "a valid base64 string" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
248
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
249
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
250
|
+
|
|
251
|
+
**Deliberately not covered**
|
|
252
|
+
|
|
253
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
254
|
+
|
|
255
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
256
|
+
| --- | --- | --- | --- | --- | --- |
|
|
257
|
+
| 20 | 0.794 µs | 1.47 µs | 0.831 µs | 477 B | 1,258,746 |
|
|
258
|
+
| 40 | 0.380 µs | 0.644 µs | 0.389 µs | 348 B | 2,630,954 |
|
|
259
|
+
| 80 | 0.409 µs | 0.704 µs | 0.424 µs | 349 B | 2,444,812 |
|
|
260
|
+
| 160 | 0.364 µs | 0.577 µs | 0.372 µs | 351 B | 2,746,305 |
|
|
261
|
+
| 320 | 0.543 µs | 0.678 µs | 0.563 µs | 486 B | 1,842,011 |
|
|
262
|
+
| 640 | 0.468 µs | 0.811 µs | 0.475 µs | 373 B | 2,136,294 |
|
|
263
|
+
| 1280 | 1.05 µs | 1.64 µs | 1.09 µs | 516 B | 952,212 |
|
|
264
|
+
| 2560 | 0.783 µs | 1.45 µs | 0.798 µs | 421 B | 1,276,825 |
|
|
265
|
+
| 5120 | 1.29 µs | 1.81 µs | 1.32 µs | 436 B | 773,694 |
|
|
266
|
+
| 10240 | 1.34 µs | 2.23 µs | 1.36 µs | 436 B | 747,670 |
|
|
267
|
+
|
|
268
|
+
### `processors.parseJSON()`
|
|
269
|
+
|
|
270
|
+
**Why we benchmark it.** Parses a JSON-valued variable (a feature-flag map, a credential blob) into an object. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
271
|
+
|
|
272
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.parseJSON(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
273
|
+
|
|
274
|
+
**Expected growth: O(n).** JSON parsing visits every character and builds one node per key and value, so cost is proportional to the size of the document.
|
|
275
|
+
|
|
276
|
+
**Variables that could change its cost**
|
|
277
|
+
|
|
278
|
+
| Variable | How it is handled | What it is |
|
|
279
|
+
| --- | --- | --- |
|
|
280
|
+
| input size | swept | Number of keys in the JSON object. |
|
|
281
|
+
| input content | fixed at "a flat JSON object of short strings" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
282
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
283
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
284
|
+
|
|
285
|
+
**Deliberately not covered**
|
|
286
|
+
|
|
287
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
288
|
+
|
|
289
|
+
**Measured: O(n)** (exponent 1.10, 10 sizes) -- ✅ matches.
|
|
290
|
+
|
|
291
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
292
|
+
| --- | --- | --- | --- | --- | --- |
|
|
293
|
+
| 20 | 1.79 µs | 2.09 µs | 1.80 µs | 435 B | 558,705 |
|
|
294
|
+
| 40 | 3.32 µs | 3.77 µs | 13.4 µs | 596 B | 300,986 |
|
|
295
|
+
| 80 | 5.75 µs | 6.86 µs | 17.1 µs | 917 B | 173,999 |
|
|
296
|
+
| 160 | 23.5 µs | 25.9 µs | 83.7 µs | 6.5 KiB | 42,577 |
|
|
297
|
+
| 320 | 39.1 µs | 41.2 µs | 90.7 µs | 12.5 KiB | 25,547 |
|
|
298
|
+
| 640 | 80.1 µs | 85.7 µs | 174 µs | 24.5 KiB | 12,488 |
|
|
299
|
+
| 1280 | 171 µs | 180 µs | 383 µs | 48.5 KiB | 5,840 |
|
|
300
|
+
| 2560 | 351 µs | 357 µs | 639 µs | 116.0 KiB | 2,846 |
|
|
301
|
+
| 5120 | 800 µs | 831 µs | 1.26 ms | 192.6 KiB | 1,249 |
|
|
302
|
+
| 10240 | 1.65 ms | 1.74 ms | 2.64 ms | 392.3 KiB | 607 |
|
|
303
|
+
|
|
304
|
+
### `processors.split(",")`
|
|
305
|
+
|
|
306
|
+
**Why we benchmark it.** Splits a delimited variable (a host list) into an array of strings. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
307
|
+
|
|
308
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.split(","), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
309
|
+
|
|
310
|
+
**Expected growth: O(n).** Splitting scans the string once and allocates one substring per field, so cost follows the length of the text.
|
|
311
|
+
|
|
312
|
+
**Variables that could change its cost**
|
|
313
|
+
|
|
314
|
+
| Variable | How it is handled | What it is |
|
|
315
|
+
| --- | --- | --- |
|
|
316
|
+
| input size | swept | Number of comma-separated fields. |
|
|
317
|
+
| input content | fixed at "short fields separated by commas" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
318
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
319
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
320
|
+
|
|
321
|
+
**Deliberately not covered**
|
|
322
|
+
|
|
323
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
324
|
+
|
|
325
|
+
**Measured: O(n)** (exponent 0.95, 10 sizes) -- ✅ matches.
|
|
326
|
+
|
|
327
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
328
|
+
| --- | --- | --- | --- | --- | --- |
|
|
329
|
+
| 20 | 0.602 µs | 1.41 µs | 0.615 µs | 723 B | 1,661,899 |
|
|
330
|
+
| 40 | 1.02 µs | 1.98 µs | 1.03 µs | 1.0 KiB | 980,939 |
|
|
331
|
+
| 80 | 1.75 µs | 2.46 µs | 1.78 µs | 1.6 KiB | 570,353 |
|
|
332
|
+
| 160 | 2.94 µs | 5.26 µs | 10.4 µs | 2.9 KiB | 340,186 |
|
|
333
|
+
| 320 | 5.47 µs | 9.11 µs | 17.7 µs | 5.4 KiB | 182,687 |
|
|
334
|
+
| 640 | 12.2 µs | 22.6 µs | 48.8 µs | 10.5 KiB | 81,664 |
|
|
335
|
+
| 1280 | 29.8 µs | 35.1 µs | 82.7 µs | 20.8 KiB | 33,543 |
|
|
336
|
+
| 2560 | 39.5 µs | 51.0 µs | 115 µs | 41.3 KiB | 25,325 |
|
|
337
|
+
| 5120 | 77.4 µs | 125 µs | 217 µs | 82.2 KiB | 12,914 |
|
|
338
|
+
| 10240 | 202 µs | 215 µs | 418 µs | 167.2 KiB | 4,950 |
|
|
339
|
+
|
|
340
|
+
### `processors.toArray(",", [trim()])`
|
|
341
|
+
|
|
342
|
+
**Why we benchmark it.** Splits a delimited variable and post-processes every element (here, trimming). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
343
|
+
|
|
344
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toArray(",", [trim()]), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
345
|
+
|
|
346
|
+
**Expected growth: O(n).** It splits once and then applies the element processor to each field, so cost is proportional to the number of elements.
|
|
347
|
+
|
|
348
|
+
**Variables that could change its cost**
|
|
349
|
+
|
|
350
|
+
| Variable | How it is handled | What it is |
|
|
351
|
+
| --- | --- | --- |
|
|
352
|
+
| input size | swept | Number of comma-separated elements. |
|
|
353
|
+
| input content | fixed at "short, space-padded fields" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
354
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
355
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
356
|
+
|
|
357
|
+
**Deliberately not covered**
|
|
358
|
+
|
|
359
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
360
|
+
|
|
361
|
+
**Measured: O(n)** (exponent 0.86, 10 sizes) -- ✅ matches.
|
|
362
|
+
|
|
363
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
364
|
+
| --- | --- | --- | --- | --- | --- |
|
|
365
|
+
| 20 | 2.80 µs | 3.95 µs | 2.94 µs | 2.7 KiB | 357,591 |
|
|
366
|
+
| 40 | 2.37 µs | 3.93 µs | 4.90 µs | 4.6 KiB | 422,760 |
|
|
367
|
+
| 80 | 4.36 µs | 9.71 µs | 17.7 µs | 8.7 KiB | 229,605 |
|
|
368
|
+
| 160 | 7.86 µs | 18.8 µs | 29.2 µs | 16.8 KiB | 127,294 |
|
|
369
|
+
| 320 | 33.7 µs | 76.4 µs | 86.1 µs | 33.3 KiB | 29,695 |
|
|
370
|
+
| 640 | 60.2 µs | 101 µs | 180 µs | 66.0 KiB | 16,604 |
|
|
371
|
+
| 1280 | 140 µs | 215 µs | 387 µs | 131.2 KiB | 7,168 |
|
|
372
|
+
| 2560 | 235 µs | 290 µs | 680 µs | 261.4 KiB | 4,262 |
|
|
373
|
+
| 5120 | 400 µs | 701 µs | 1.10 ms | 539.7 KiB | 2,499 |
|
|
374
|
+
| 10240 | 693 µs | 828 µs | 1.78 ms | 1.1 MiB | 1,442 |
|
|
375
|
+
|
|
376
|
+
### `processors.toBigInt()`
|
|
377
|
+
|
|
378
|
+
**Why we benchmark it.** Parses a very large integer (a numeric identifier, a counter) without losing precision. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
379
|
+
|
|
380
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toBigInt(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
381
|
+
|
|
382
|
+
**Expected growth: O(n²).** Each decimal digit multiplies the integer built so far, which grows with the digits already read, so the cost grows faster than the digit count; CI measured an exponent near 1.6, and quadratic is the nearest class.
|
|
383
|
+
|
|
384
|
+
**Variables that could change its cost**
|
|
385
|
+
|
|
386
|
+
| Variable | How it is handled | What it is |
|
|
387
|
+
| --- | --- | --- |
|
|
388
|
+
| input size | swept | Number of decimal digits. |
|
|
389
|
+
| input content | fixed at "a string of the digit 1" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
390
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
391
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
392
|
+
|
|
393
|
+
**Deliberately not covered**
|
|
394
|
+
|
|
395
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
396
|
+
|
|
397
|
+
**Measured: O(n log n)** (exponent 1.60, 10 sizes) -- 🟡 close (neighbouring class).
|
|
398
|
+
|
|
399
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
400
|
+
| --- | --- | --- | --- | --- | --- |
|
|
401
|
+
| 20 | 0.176 µs | 0.301 µs | 0.184 µs | 282 B | 5,691,955 |
|
|
402
|
+
| 40 | 0.170 µs | 0.196 µs | 0.173 µs | 289 B | 5,887,083 |
|
|
403
|
+
| 80 | 0.224 µs | 0.264 µs | 0.229 µs | 305 B | 4,455,161 |
|
|
404
|
+
| 160 | 0.484 µs | 0.514 µs | 0.488 µs | 337 B | 2,065,137 |
|
|
405
|
+
| 320 | 0.894 µs | 0.938 µs | 0.901 µs | 401 B | 1,118,126 |
|
|
406
|
+
| 640 | 1.86 µs | 1.97 µs | 6.95 µs | 538 B | 536,515 |
|
|
407
|
+
| 1280 | 4.30 µs | 4.60 µs | 12.2 µs | 811 B | 232,667 |
|
|
408
|
+
| 2560 | 13.3 µs | 14.1 µs | 32.2 µs | 1.3 KiB | 74,957 |
|
|
409
|
+
| 5120 | 45.4 µs | 46.7 µs | 98.3 µs | 2.4 KiB | 22,009 |
|
|
410
|
+
| 10240 | 146 µs | 150 µs | 313 µs | 4.5 KiB | 6,830 |
|
|
411
|
+
|
|
412
|
+
### `processors.toBoolean()`
|
|
413
|
+
|
|
414
|
+
**Why we benchmark it.** Interprets a flag variable ("true", "1", "yes") as a boolean. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
415
|
+
|
|
416
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toBoolean(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
417
|
+
|
|
418
|
+
**Expected growth: O(1).** It compares the value against a short fixed list of accepted spellings, independent of anything else.
|
|
419
|
+
|
|
420
|
+
**Variables that could change its cost**
|
|
421
|
+
|
|
422
|
+
| Variable | How it is handled | What it is |
|
|
423
|
+
| --- | --- | --- |
|
|
424
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always the short flag "true". |
|
|
425
|
+
| input content | fixed at "the string \"true\"" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
426
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
427
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
428
|
+
|
|
429
|
+
**Deliberately not covered**
|
|
430
|
+
|
|
431
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
432
|
+
|
|
433
|
+
**Measured: O(1)** (exponent -0.01, 10 sizes) -- ✅ matches.
|
|
434
|
+
|
|
435
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
436
|
+
| --- | --- | --- | --- | --- | --- |
|
|
437
|
+
| 20 | 0.183 µs | 0.329 µs | 0.191 µs | 322 B | 5,461,781 |
|
|
438
|
+
| 40 | 0.0971 µs | 0.182 µs | 0.103 µs | 273 B | 10,294,972 |
|
|
439
|
+
| 80 | 0.0936 µs | 0.164 µs | 0.0974 µs | 273 B | 10,685,263 |
|
|
440
|
+
| 160 | 0.110 µs | 0.147 µs | 0.117 µs | 273 B | 9,084,446 |
|
|
441
|
+
| 320 | 0.104 µs | 0.159 µs | 0.109 µs | 273 B | 9,604,976 |
|
|
442
|
+
| 640 | 0.102 µs | 0.155 µs | 0.107 µs | 273 B | 9,826,392 |
|
|
443
|
+
| 1280 | 0.109 µs | 0.153 µs | 0.116 µs | 273 B | 9,155,511 |
|
|
444
|
+
| 2560 | 0.105 µs | 0.157 µs | 0.109 µs | 273 B | 9,536,401 |
|
|
445
|
+
| 5120 | 0.102 µs | 0.131 µs | 0.106 µs | 273 B | 9,768,979 |
|
|
446
|
+
| 10240 | 0.102 µs | 0.146 µs | 0.108 µs | 273 B | 9,777,039 |
|
|
447
|
+
|
|
448
|
+
### `processors.toDate()`
|
|
449
|
+
|
|
450
|
+
**Why we benchmark it.** Parses a date variable (a license expiry) into a Date. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
451
|
+
|
|
452
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toDate(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
453
|
+
|
|
454
|
+
**Expected growth: O(1).** A date string has a fixed maximum length and the parser does a fixed amount of work for it.
|
|
455
|
+
|
|
456
|
+
**Variables that could change its cost**
|
|
457
|
+
|
|
458
|
+
| Variable | How it is handled | What it is |
|
|
459
|
+
| --- | --- | --- |
|
|
460
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one ISO date. |
|
|
461
|
+
| input content | fixed at "an ISO 8601 timestamp" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
462
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
463
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
464
|
+
|
|
465
|
+
**Deliberately not covered**
|
|
466
|
+
|
|
467
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
468
|
+
|
|
469
|
+
**Measured: O(1)** (exponent -0.00, 10 sizes) -- ✅ matches.
|
|
470
|
+
|
|
471
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
472
|
+
| --- | --- | --- | --- | --- | --- |
|
|
473
|
+
| 20 | 0.325 µs | 0.486 µs | 0.338 µs | 362 B | 3,075,732 |
|
|
474
|
+
| 40 | 0.318 µs | 0.393 µs | 0.322 µs | 361 B | 3,147,503 |
|
|
475
|
+
| 80 | 0.322 µs | 0.407 µs | 0.328 µs | 362 B | 3,101,765 |
|
|
476
|
+
| 160 | 0.317 µs | 0.363 µs | 0.323 µs | 361 B | 3,152,436 |
|
|
477
|
+
| 320 | 0.335 µs | 0.394 µs | 0.342 µs | 361 B | 2,988,407 |
|
|
478
|
+
| 640 | 0.319 µs | 0.371 µs | 0.325 µs | 362 B | 3,134,948 |
|
|
479
|
+
| 1280 | 0.316 µs | 0.368 µs | 0.322 µs | 361 B | 3,165,958 |
|
|
480
|
+
| 2560 | 0.325 µs | 0.400 µs | 0.330 µs | 361 B | 3,081,647 |
|
|
481
|
+
| 5120 | 0.319 µs | 0.385 µs | 0.324 µs | 361 B | 3,137,842 |
|
|
482
|
+
| 10240 | 0.312 µs | 0.368 µs | 0.319 µs | 362 B | 3,200,703 |
|
|
483
|
+
|
|
484
|
+
### `processors.toInteger()`
|
|
485
|
+
|
|
486
|
+
**Why we benchmark it.** Parses a whole-number variable (a port, a pool size). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
487
|
+
|
|
488
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toInteger(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
489
|
+
|
|
490
|
+
**Expected growth: O(1).** Port-sized numbers have a fixed small length, so parsing and validating one is a fixed amount of work.
|
|
491
|
+
|
|
492
|
+
**Variables that could change its cost**
|
|
493
|
+
|
|
494
|
+
| Variable | How it is handled | What it is |
|
|
495
|
+
| --- | --- | --- |
|
|
496
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always a short integer. |
|
|
497
|
+
| input content | fixed at "the string \"17\"" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
498
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
499
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
500
|
+
|
|
501
|
+
**Deliberately not covered**
|
|
502
|
+
|
|
503
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
504
|
+
|
|
505
|
+
**Measured: O(1)** (exponent -0.02, 10 sizes) -- ✅ matches.
|
|
506
|
+
|
|
507
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
508
|
+
| --- | --- | --- | --- | --- | --- |
|
|
509
|
+
| 20 | 0.0852 µs | 0.226 µs | 0.0897 µs | 305 B | 11,735,206 |
|
|
510
|
+
| 40 | 0.0838 µs | 0.207 µs | 0.0890 µs | 305 B | 11,932,160 |
|
|
511
|
+
| 80 | 0.0871 µs | 0.157 µs | 0.0917 µs | 305 B | 11,476,503 |
|
|
512
|
+
| 160 | 0.0877 µs | 0.116 µs | 0.0915 µs | 305 B | 11,401,586 |
|
|
513
|
+
| 320 | 0.0889 µs | 0.161 µs | 0.0917 µs | 305 B | 11,251,589 |
|
|
514
|
+
| 640 | 0.0869 µs | 0.182 µs | 0.0897 µs | 305 B | 11,511,896 |
|
|
515
|
+
| 1280 | 0.0852 µs | 0.161 µs | 0.0899 µs | 305 B | 11,741,084 |
|
|
516
|
+
| 2560 | 0.0828 µs | 0.182 µs | 0.0870 µs | 305 B | 12,070,112 |
|
|
517
|
+
| 5120 | 0.0818 µs | 0.154 µs | 0.0877 µs | 305 B | 12,226,512 |
|
|
518
|
+
| 10240 | 0.0827 µs | 0.156 µs | 0.0855 µs | 305 B | 12,097,337 |
|
|
519
|
+
|
|
520
|
+
### `processors.toLowerCase()`
|
|
521
|
+
|
|
522
|
+
**Why we benchmark it.** Normalizes a variable (an environment name, a hostname) to lower case. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
523
|
+
|
|
524
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toLowerCase(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
525
|
+
|
|
526
|
+
**Expected growth: O(n).** Case conversion visits every character once.
|
|
527
|
+
|
|
528
|
+
**Variables that could change its cost**
|
|
529
|
+
|
|
530
|
+
| Variable | How it is handled | What it is |
|
|
531
|
+
| --- | --- | --- |
|
|
532
|
+
| input size | swept | Length of the string, in characters. |
|
|
533
|
+
| input content | fixed at "mixed-case ASCII" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
534
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
535
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
536
|
+
|
|
537
|
+
**Deliberately not covered**
|
|
538
|
+
|
|
539
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
540
|
+
|
|
541
|
+
**Measured: O(n)** (exponent 0.69, 10 sizes) -- ✅ matches.
|
|
542
|
+
|
|
543
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
544
|
+
| --- | --- | --- | --- | --- | --- |
|
|
545
|
+
| 20 | 0.103 µs | 0.146 µs | 0.109 µs | 289 B | 9,746,883 |
|
|
546
|
+
| 40 | 0.0960 µs | 0.121 µs | 0.0998 µs | 305 B | 10,413,509 |
|
|
547
|
+
| 80 | 0.104 µs | 0.147 µs | 0.109 µs | 345 B | 9,575,189 |
|
|
548
|
+
| 160 | 0.110 µs | 0.136 µs | 0.115 µs | 425 B | 9,065,625 |
|
|
549
|
+
| 320 | 0.133 µs | 0.172 µs | 0.136 µs | 585 B | 7,528,108 |
|
|
550
|
+
| 640 | 0.177 µs | 0.230 µs | 0.183 µs | 905 B | 5,651,794 |
|
|
551
|
+
| 1280 | 0.264 µs | 0.301 µs | 0.269 µs | 1.5 KiB | 3,783,762 |
|
|
552
|
+
| 2560 | 0.402 µs | 0.503 µs | 0.407 µs | 2.8 KiB | 2,486,455 |
|
|
553
|
+
| 5120 | 0.685 µs | 0.752 µs | 2.81 µs | 5.4 KiB | 1,458,977 |
|
|
554
|
+
| 10240 | 1.20 µs | 1.27 µs | 4.49 µs | 10.5 KiB | 835,357 |
|
|
555
|
+
|
|
556
|
+
### `processors.toNumber()`
|
|
557
|
+
|
|
558
|
+
**Why we benchmark it.** Parses a numeric variable (a timeout, a ratio). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
559
|
+
|
|
560
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toNumber(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
561
|
+
|
|
562
|
+
**Expected growth: O(1).** A number literal has a fixed small length and is parsed in one pass.
|
|
563
|
+
|
|
564
|
+
**Variables that could change its cost**
|
|
565
|
+
|
|
566
|
+
| Variable | How it is handled | What it is |
|
|
567
|
+
| --- | --- | --- |
|
|
568
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always a short number. |
|
|
569
|
+
| input content | fixed at "the string \"42\"" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
570
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
571
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
572
|
+
|
|
573
|
+
**Deliberately not covered**
|
|
574
|
+
|
|
575
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
576
|
+
|
|
577
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
578
|
+
|
|
579
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
580
|
+
| --- | --- | --- | --- | --- | --- |
|
|
581
|
+
| 20 | 0.0808 µs | 0.121 µs | 0.0833 µs | 249 B | 12,371,966 |
|
|
582
|
+
| 40 | 0.0806 µs | 0.119 µs | 0.0857 µs | 249 B | 12,412,548 |
|
|
583
|
+
| 80 | 0.0816 µs | 0.141 µs | 0.0851 µs | 249 B | 12,249,153 |
|
|
584
|
+
| 160 | 0.0795 µs | 0.115 µs | 0.0815 µs | 248 B | 12,583,893 |
|
|
585
|
+
| 320 | 0.0800 µs | 0.117 µs | 0.0835 µs | 249 B | 12,505,464 |
|
|
586
|
+
| 640 | 0.0817 µs | 0.119 µs | 0.0853 µs | 249 B | 12,246,070 |
|
|
587
|
+
| 1280 | 0.0823 µs | 0.136 µs | 0.0884 µs | 249 B | 12,150,267 |
|
|
588
|
+
| 2560 | 0.0814 µs | 0.117 µs | 0.0836 µs | 248 B | 12,287,582 |
|
|
589
|
+
| 5120 | 0.0830 µs | 0.123 µs | 0.0866 µs | 249 B | 12,049,390 |
|
|
590
|
+
| 10240 | 0.0818 µs | 0.121 µs | 0.0841 µs | 248 B | 12,224,221 |
|
|
591
|
+
|
|
592
|
+
### `processors.toRegExp()`
|
|
593
|
+
|
|
594
|
+
**Why we benchmark it.** Compiles a pattern variable (an allow-list) into a RegExp. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
595
|
+
|
|
596
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toRegExp(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
597
|
+
|
|
598
|
+
**Expected growth: O(n).** Compiling a pattern parses it once, so cost follows the length of the pattern.
|
|
599
|
+
|
|
600
|
+
**Variables that could change its cost**
|
|
601
|
+
|
|
602
|
+
| Variable | How it is handled | What it is |
|
|
603
|
+
| --- | --- | --- |
|
|
604
|
+
| input size | swept | Length of the pattern, in characters. |
|
|
605
|
+
| input content | fixed at "an anchored run of the letter a" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
606
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
607
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
608
|
+
|
|
609
|
+
**Deliberately not covered**
|
|
610
|
+
|
|
611
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
612
|
+
|
|
613
|
+
**Measured: O(n)** (exponent 0.77, 10 sizes) -- ✅ matches.
|
|
614
|
+
|
|
615
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
616
|
+
| --- | --- | --- | --- | --- | --- |
|
|
617
|
+
| 20 | 0.207 µs | 0.278 µs | 0.216 µs | 318 B | 4,839,843 |
|
|
618
|
+
| 40 | 0.226 µs | 0.260 µs | 0.231 µs | 314 B | 4,420,679 |
|
|
619
|
+
| 80 | 0.291 µs | 0.355 µs | 0.299 µs | 321 B | 3,441,876 |
|
|
620
|
+
| 160 | 0.390 µs | 0.459 µs | 0.396 µs | 316 B | 2,563,123 |
|
|
621
|
+
| 320 | 0.595 µs | 0.631 µs | 0.601 µs | 315 B | 1,679,529 |
|
|
622
|
+
| 640 | 0.998 µs | 1.07 µs | 2.08 µs | 318 B | 1,002,087 |
|
|
623
|
+
| 1280 | 1.57 µs | 1.73 µs | 5.87 µs | 321 B | 637,182 |
|
|
624
|
+
| 2560 | 2.55 µs | 2.72 µs | 7.58 µs | 323 B | 391,618 |
|
|
625
|
+
| 5120 | 4.50 µs | 4.98 µs | 12.7 µs | 335 B | 222,440 |
|
|
626
|
+
| 10240 | 8.50 µs | 9.49 µs | 21.8 µs | 354 B | 117,682 |
|
|
627
|
+
|
|
628
|
+
### `processors.toString()`
|
|
629
|
+
|
|
630
|
+
**Why we benchmark it.** Coerces a value to a string (the explicit no-op for variables that are already text). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
631
|
+
|
|
632
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toString(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
633
|
+
|
|
634
|
+
**Expected growth: O(1).** Converting a small number to its string form is a fixed amount of work.
|
|
635
|
+
|
|
636
|
+
**Variables that could change its cost**
|
|
637
|
+
|
|
638
|
+
| Variable | How it is handled | What it is |
|
|
639
|
+
| --- | --- | --- |
|
|
640
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always the number 42. |
|
|
641
|
+
| input content | fixed at "the number 42" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
642
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
643
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
644
|
+
|
|
645
|
+
**Deliberately not covered**
|
|
646
|
+
|
|
647
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
648
|
+
|
|
649
|
+
**Measured: O(1)** (exponent -0.02, 10 sizes) -- ✅ matches.
|
|
650
|
+
|
|
651
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
652
|
+
| --- | --- | --- | --- | --- | --- |
|
|
653
|
+
| 20 | 0.0864 µs | 0.109 µs | 0.0907 µs | 249 B | 11,573,866 |
|
|
654
|
+
| 40 | 0.0819 µs | 0.0970 µs | 0.0836 µs | 248 B | 12,212,720 |
|
|
655
|
+
| 80 | 0.0818 µs | 0.0982 µs | 0.0843 µs | 249 B | 12,223,344 |
|
|
656
|
+
| 160 | 0.0830 µs | 0.0886 µs | 0.0856 µs | 249 B | 12,049,021 |
|
|
657
|
+
| 320 | 0.0847 µs | 0.0976 µs | 0.0868 µs | 249 B | 11,808,221 |
|
|
658
|
+
| 640 | 0.0862 µs | 0.109 µs | 0.0907 µs | 249 B | 11,598,196 |
|
|
659
|
+
| 1280 | 0.0864 µs | 0.110 µs | 0.0890 µs | 249 B | 11,579,337 |
|
|
660
|
+
| 2560 | 0.0846 µs | 0.100 µs | 0.0873 µs | 249 B | 11,818,363 |
|
|
661
|
+
| 5120 | 0.0847 µs | 0.0930 µs | 0.0870 µs | 249 B | 11,802,783 |
|
|
662
|
+
| 10240 | 0.0813 µs | 0.0947 µs | 0.0830 µs | 248 B | 12,305,374 |
|
|
663
|
+
|
|
664
|
+
### `processors.toURL()`
|
|
665
|
+
|
|
666
|
+
**Why we benchmark it.** Parses an endpoint variable (an API base URL) into a URL object. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
667
|
+
|
|
668
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toURL(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
669
|
+
|
|
670
|
+
**Expected growth: O(n).** URL parsing scans the string once to split it into components, so cost follows its length.
|
|
671
|
+
|
|
672
|
+
**Variables that could change its cost**
|
|
673
|
+
|
|
674
|
+
| Variable | How it is handled | What it is |
|
|
675
|
+
| --- | --- | --- |
|
|
676
|
+
| input size | swept | Length of the URL path, in characters. |
|
|
677
|
+
| input content | fixed at "an https URL with a long path" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
678
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
679
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
680
|
+
|
|
681
|
+
**Deliberately not covered**
|
|
682
|
+
|
|
683
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
684
|
+
|
|
685
|
+
**Measured: O(log n)** (exponent 0.61, 10 sizes) -- 🟡 close (neighbouring class).
|
|
686
|
+
|
|
687
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
688
|
+
| --- | --- | --- | --- | --- | --- |
|
|
689
|
+
| 20 | 0.614 µs | 1.21 µs | 0.808 µs | 523 B | 1,628,771 |
|
|
690
|
+
| 40 | 0.484 µs | 0.593 µs | 0.494 µs | 546 B | 2,065,936 |
|
|
691
|
+
| 80 | 0.505 µs | 0.569 µs | 0.514 µs | 586 B | 1,979,903 |
|
|
692
|
+
| 160 | 0.552 µs | 0.608 µs | 0.560 µs | 665 B | 1,811,213 |
|
|
693
|
+
| 320 | 0.656 µs | 0.736 µs | 0.665 µs | 826 B | 1,523,812 |
|
|
694
|
+
| 640 | 0.794 µs | 0.916 µs | 0.804 µs | 1.1 KiB | 1,259,087 |
|
|
695
|
+
| 1280 | 1.07 µs | 1.16 µs | 1.09 µs | 1.7 KiB | 930,250 |
|
|
696
|
+
| 2560 | 1.59 µs | 1.75 µs | 3.36 µs | 3.0 KiB | 627,243 |
|
|
697
|
+
| 5120 | 2.48 µs | 2.59 µs | 9.45 µs | 5.6 KiB | 403,570 |
|
|
698
|
+
| 10240 | 4.26 µs | 4.44 µs | 15.0 µs | 10.6 KiB | 234,736 |
|
|
699
|
+
|
|
700
|
+
### `processors.toUpperCase()`
|
|
701
|
+
|
|
702
|
+
**Why we benchmark it.** Normalizes a variable to upper case. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
703
|
+
|
|
704
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.toUpperCase(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
705
|
+
|
|
706
|
+
**Expected growth: O(n).** Case conversion visits every character once.
|
|
707
|
+
|
|
708
|
+
**Variables that could change its cost**
|
|
709
|
+
|
|
710
|
+
| Variable | How it is handled | What it is |
|
|
711
|
+
| --- | --- | --- |
|
|
712
|
+
| input size | swept | Length of the string, in characters. |
|
|
713
|
+
| input content | fixed at "mixed-case ASCII" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
714
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
715
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
716
|
+
|
|
717
|
+
**Deliberately not covered**
|
|
718
|
+
|
|
719
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
720
|
+
|
|
721
|
+
**Measured: O(n)** (exponent 0.75, 10 sizes) -- ✅ matches.
|
|
722
|
+
|
|
723
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
724
|
+
| --- | --- | --- | --- | --- | --- |
|
|
725
|
+
| 20 | 0.108 µs | 0.146 µs | 0.111 µs | 289 B | 9,276,032 |
|
|
726
|
+
| 40 | 0.106 µs | 0.143 µs | 0.112 µs | 305 B | 9,413,006 |
|
|
727
|
+
| 80 | 0.106 µs | 0.139 µs | 0.109 µs | 345 B | 9,452,992 |
|
|
728
|
+
| 160 | 0.118 µs | 0.156 µs | 0.123 µs | 425 B | 8,449,004 |
|
|
729
|
+
| 320 | 0.140 µs | 0.188 µs | 0.143 µs | 585 B | 7,151,021 |
|
|
730
|
+
| 640 | 0.182 µs | 0.228 µs | 0.186 µs | 905 B | 5,506,347 |
|
|
731
|
+
| 1280 | 0.266 µs | 0.334 µs | 0.271 µs | 1.5 KiB | 3,762,001 |
|
|
732
|
+
| 2560 | 0.485 µs | 0.895 µs | 0.501 µs | 2.8 KiB | 2,061,111 |
|
|
733
|
+
| 5120 | 0.814 µs | 1.33 µs | 0.830 µs | 5.4 KiB | 1,228,486 |
|
|
734
|
+
| 10240 | 1.38 µs | 1.92 µs | 4.79 µs | 10.5 KiB | 725,884 |
|
|
735
|
+
|
|
736
|
+
### `processors.trim()`
|
|
737
|
+
|
|
738
|
+
**Why we benchmark it.** Strips accidental whitespace around a value copied from a dashboard or a file. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
739
|
+
|
|
740
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses processors.trim(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
741
|
+
|
|
742
|
+
**Expected growth: O(n).** Trimming scans in from both ends and copies the remaining text, so cost follows the length of the string.
|
|
743
|
+
|
|
744
|
+
**Variables that could change its cost**
|
|
745
|
+
|
|
746
|
+
| Variable | How it is handled | What it is |
|
|
747
|
+
| --- | --- | --- |
|
|
748
|
+
| input size | swept | Number of padding characters on each side. |
|
|
749
|
+
| input content | fixed at "a short word padded with spaces" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
750
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
751
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
752
|
+
|
|
753
|
+
**Deliberately not covered**
|
|
754
|
+
|
|
755
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
756
|
+
|
|
757
|
+
**Measured: O(n)** (exponent 0.89, 10 sizes) -- ✅ matches.
|
|
758
|
+
|
|
759
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
760
|
+
| --- | --- | --- | --- | --- | --- |
|
|
761
|
+
| 20 | 0.137 µs | 0.156 µs | 0.139 µs | 273 B | 7,325,203 |
|
|
762
|
+
| 40 | 0.183 µs | 0.238 µs | 0.189 µs | 273 B | 5,470,754 |
|
|
763
|
+
| 80 | 0.280 µs | 0.392 µs | 0.283 µs | 273 B | 3,573,634 |
|
|
764
|
+
| 160 | 0.432 µs | 0.560 µs | 0.436 µs | 273 B | 2,312,164 |
|
|
765
|
+
| 320 | 0.717 µs | 0.793 µs | 0.725 µs | 273 B | 1,395,328 |
|
|
766
|
+
| 640 | 1.04 µs | 1.12 µs | 3.47 µs | 273 B | 960,414 |
|
|
767
|
+
| 1280 | 1.89 µs | 2.01 µs | 5.89 µs | 273 B | 528,711 |
|
|
768
|
+
| 2560 | 3.49 µs | 3.72 µs | 10.2 µs | 274 B | 286,604 |
|
|
769
|
+
| 5120 | 6.18 µs | 6.53 µs | 15.8 µs | 276 B | 161,819 |
|
|
770
|
+
| 10240 | 12.5 µs | 13.0 µs | 31.9 µs | 279 B | 80,016 |
|
|
771
|
+
|
|
772
|
+
### `validators.after(date)`
|
|
773
|
+
|
|
774
|
+
**Why we benchmark it.** Requires a date to be later than a fixed instant (a license start). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
775
|
+
|
|
776
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.after(date). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
777
|
+
|
|
778
|
+
**Expected growth: O(1).** It compares two timestamps.
|
|
779
|
+
|
|
780
|
+
**Variables that could change its cost**
|
|
781
|
+
|
|
782
|
+
| Variable | How it is handled | What it is |
|
|
783
|
+
| --- | --- | --- |
|
|
784
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one date. |
|
|
785
|
+
| input content | fixed at "a date after the threshold" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
786
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
787
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
788
|
+
|
|
789
|
+
**Deliberately not covered**
|
|
790
|
+
|
|
791
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
792
|
+
|
|
793
|
+
**Measured: O(1)** (exponent -0.01, 10 sizes) -- ✅ matches.
|
|
794
|
+
|
|
795
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
796
|
+
| --- | --- | --- | --- | --- | --- |
|
|
797
|
+
| 20 | 0.291 µs | 0.417 µs | 0.325 µs | 356 B | 3,437,877 |
|
|
798
|
+
| 40 | 0.197 µs | 0.316 µs | 0.204 µs | 306 B | 5,080,023 |
|
|
799
|
+
| 80 | 0.190 µs | 0.297 µs | 0.194 µs | 305 B | 5,270,225 |
|
|
800
|
+
| 160 | 0.183 µs | 0.357 µs | 0.190 µs | 249 B | 5,460,942 |
|
|
801
|
+
| 320 | 0.186 µs | 0.225 µs | 0.192 µs | 249 B | 5,362,698 |
|
|
802
|
+
| 640 | 0.186 µs | 0.301 µs | 0.191 µs | 249 B | 5,376,043 |
|
|
803
|
+
| 1280 | 0.195 µs | 0.326 µs | 0.202 µs | 250 B | 5,123,482 |
|
|
804
|
+
| 2560 | 0.190 µs | 0.341 µs | 0.197 µs | 249 B | 5,267,232 |
|
|
805
|
+
| 5120 | 0.186 µs | 0.314 µs | 0.191 µs | 249 B | 5,387,594 |
|
|
806
|
+
| 10240 | 0.182 µs | 0.356 µs | 0.191 µs | 249 B | 5,486,233 |
|
|
807
|
+
|
|
808
|
+
### `validators.all(...validators)`
|
|
809
|
+
|
|
810
|
+
**Why we benchmark it.** Combines several validators that must all pass (a number that must be positive and below a cap). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
811
|
+
|
|
812
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.all(...validators), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
813
|
+
|
|
814
|
+
**Expected growth: O(n).** It runs each inner validator in turn until one fails, so with every inner validator passing, cost is proportional to how many were combined.
|
|
815
|
+
|
|
816
|
+
**Variables that could change its cost**
|
|
817
|
+
|
|
818
|
+
| Variable | How it is handled | What it is |
|
|
819
|
+
| --- | --- | --- |
|
|
820
|
+
| input size | swept | Number of inner validators combined. |
|
|
821
|
+
| input content | fixed at "an in-range number that every inner validator accepts" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
822
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
823
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
824
|
+
|
|
825
|
+
**Deliberately not covered**
|
|
826
|
+
|
|
827
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
828
|
+
|
|
829
|
+
**Measured: O(n)** (exponent 0.97, 10 sizes) -- ✅ matches.
|
|
830
|
+
|
|
831
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
832
|
+
| --- | --- | --- | --- | --- | --- |
|
|
833
|
+
| 20 | 0.124 µs | 1.25 µs | 0.146 µs | 252 B | 8,078,424 |
|
|
834
|
+
| 40 | 0.154 µs | 0.764 µs | 0.161 µs | 250 B | 6,495,626 |
|
|
835
|
+
| 80 | 0.236 µs | 2.18 µs | 0.243 µs | 250 B | 4,240,333 |
|
|
836
|
+
| 160 | 0.394 µs | 0.821 µs | 0.409 µs | 250 B | 2,536,520 |
|
|
837
|
+
| 320 | 0.715 µs | 2.46 µs | 0.741 µs | 252 B | 1,399,278 |
|
|
838
|
+
| 640 | 1.39 µs | 1.63 µs | 1.43 µs | 256 B | 718,468 |
|
|
839
|
+
| 1280 | 2.77 µs | 4.89 µs | 2.86 µs | 455 B | 361,300 |
|
|
840
|
+
| 2560 | 5.28 µs | 6.28 µs | 5.40 µs | 464 B | 189,322 |
|
|
841
|
+
| 5120 | 10.5 µs | 12.9 µs | 10.7 µs | 301 B | 95,488 |
|
|
842
|
+
| 10240 | 20.9 µs | 24.1 µs | 21.7 µs | 539 B | 47,821 |
|
|
843
|
+
|
|
844
|
+
### `validators.any(...validators)`
|
|
845
|
+
|
|
846
|
+
**Why we benchmark it.** Combines alternatives where one passing is enough (an IPv4 or IPv6 address). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
847
|
+
|
|
848
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.any(...validators), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
849
|
+
|
|
850
|
+
**Expected growth: O(n).** It tries each inner validator until one passes; with the passing one last, cost is proportional to how many were combined.
|
|
851
|
+
|
|
852
|
+
**Variables that could change its cost**
|
|
853
|
+
|
|
854
|
+
| Variable | How it is handled | What it is |
|
|
855
|
+
| --- | --- | --- |
|
|
856
|
+
| input size | swept | Number of alternatives, the last of which is the one that passes. |
|
|
857
|
+
| input content | fixed at "a value only the final alternative accepts" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
858
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
859
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
860
|
+
|
|
861
|
+
**Deliberately not covered**
|
|
862
|
+
|
|
863
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
864
|
+
|
|
865
|
+
**Measured: O(n)** (exponent 0.99, 10 sizes) -- ✅ matches.
|
|
866
|
+
|
|
867
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
868
|
+
| --- | --- | --- | --- | --- | --- |
|
|
869
|
+
| 20 | 0.356 µs | 1.74 µs | 0.375 µs | 1.5 KiB | 2,806,722 |
|
|
870
|
+
| 40 | 0.598 µs | 0.813 µs | 0.602 µs | 2.7 KiB | 1,672,553 |
|
|
871
|
+
| 80 | 1.20 µs | 1.35 µs | 1.22 µs | 5.2 KiB | 833,718 |
|
|
872
|
+
| 160 | 2.31 µs | 2.71 µs | 2.34 µs | 10.4 KiB | 433,361 |
|
|
873
|
+
| 320 | 4.43 µs | 4.89 µs | 9.33 µs | 20.2 KiB | 225,778 |
|
|
874
|
+
| 640 | 8.81 µs | 9.91 µs | 8.87 µs | 40.2 KiB | 113,510 |
|
|
875
|
+
| 1280 | 17.5 µs | 19.5 µs | 54.6 µs | 80.4 KiB | 57,024 |
|
|
876
|
+
| 2560 | 33.5 µs | 35.7 µs | 69.6 µs | 160.4 KiB | 29,831 |
|
|
877
|
+
| 5120 | 67.5 µs | 75.1 µs | 140 µs | 320.5 KiB | 14,818 |
|
|
878
|
+
| 10240 | 138 µs | 147 µs | 291 µs | 640.5 KiB | 7,228 |
|
|
879
|
+
|
|
880
|
+
### `validators.before(date)`
|
|
881
|
+
|
|
882
|
+
**Why we benchmark it.** Requires a date to be earlier than a fixed instant (a migration cut-off). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
883
|
+
|
|
884
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.before(date). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
885
|
+
|
|
886
|
+
**Expected growth: O(1).** It compares two timestamps.
|
|
887
|
+
|
|
888
|
+
**Variables that could change its cost**
|
|
889
|
+
|
|
890
|
+
| Variable | How it is handled | What it is |
|
|
891
|
+
| --- | --- | --- |
|
|
892
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one date. |
|
|
893
|
+
| input content | fixed at "a date before the threshold" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
894
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
895
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
896
|
+
|
|
897
|
+
**Deliberately not covered**
|
|
898
|
+
|
|
899
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
900
|
+
|
|
901
|
+
**Measured: O(1)** (exponent 0.01, 10 sizes) -- ✅ matches.
|
|
902
|
+
|
|
903
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
904
|
+
| --- | --- | --- | --- | --- | --- |
|
|
905
|
+
| 20 | 0.190 µs | 0.309 µs | 0.194 µs | 249 B | 5,269,456 |
|
|
906
|
+
| 40 | 0.189 µs | 0.343 µs | 0.196 µs | 249 B | 5,299,093 |
|
|
907
|
+
| 80 | 0.191 µs | 0.348 µs | 0.195 µs | 249 B | 5,243,759 |
|
|
908
|
+
| 160 | 0.186 µs | 0.330 µs | 0.191 µs | 249 B | 5,374,628 |
|
|
909
|
+
| 320 | 0.186 µs | 0.303 µs | 0.191 µs | 249 B | 5,369,054 |
|
|
910
|
+
| 640 | 0.181 µs | 0.285 µs | 0.187 µs | 249 B | 5,529,298 |
|
|
911
|
+
| 1280 | 0.183 µs | 0.214 µs | 0.188 µs | 249 B | 5,456,648 |
|
|
912
|
+
| 2560 | 0.187 µs | 0.307 µs | 0.192 µs | 249 B | 5,356,596 |
|
|
913
|
+
| 5120 | 0.182 µs | 0.354 µs | 0.188 µs | 249 B | 5,481,388 |
|
|
914
|
+
| 10240 | 0.189 µs | 0.342 µs | 0.199 µs | 250 B | 5,286,439 |
|
|
915
|
+
|
|
916
|
+
### `validators.custom(fn)`
|
|
917
|
+
|
|
918
|
+
**Why we benchmark it.** Wraps an application-supplied check as a validator. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
919
|
+
|
|
920
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.custom(fn). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
921
|
+
|
|
922
|
+
**Expected growth: O(1).** It forwards to the supplied function; the wrapper itself adds a fixed cost (the supplied function's own cost belongs to the application).
|
|
923
|
+
|
|
924
|
+
**Variables that could change its cost**
|
|
925
|
+
|
|
926
|
+
| Variable | How it is handled | What it is |
|
|
927
|
+
| --- | --- | --- |
|
|
928
|
+
| input size | swept | Varied only to show the wrapper ignores it; the supplied check is a single comparison. |
|
|
929
|
+
| input content | fixed at "a positive number" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
930
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
931
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
932
|
+
|
|
933
|
+
**Deliberately not covered**
|
|
934
|
+
|
|
935
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
936
|
+
|
|
937
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
938
|
+
|
|
939
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
940
|
+
| --- | --- | --- | --- | --- | --- |
|
|
941
|
+
| 20 | 0.0676 µs | 0.171 µs | 0.0723 µs | 249 B | 14,792,372 |
|
|
942
|
+
| 40 | 0.0664 µs | 0.181 µs | 0.0711 µs | 249 B | 15,053,687 |
|
|
943
|
+
| 80 | 0.0661 µs | 0.190 µs | 0.0697 µs | 249 B | 15,120,569 |
|
|
944
|
+
| 160 | 0.0662 µs | 0.167 µs | 0.0693 µs | 249 B | 15,107,274 |
|
|
945
|
+
| 320 | 0.0661 µs | 0.201 µs | 0.0704 µs | 249 B | 15,122,155 |
|
|
946
|
+
| 640 | 0.0655 µs | 0.175 µs | 0.0687 µs | 249 B | 15,264,115 |
|
|
947
|
+
| 1280 | 0.0675 µs | 0.177 µs | 0.0710 µs | 249 B | 14,814,579 |
|
|
948
|
+
| 2560 | 0.0698 µs | 0.182 µs | 0.0762 µs | 249 B | 14,335,776 |
|
|
949
|
+
| 5120 | 0.0667 µs | 0.0717 µs | 0.0692 µs | 249 B | 14,985,784 |
|
|
950
|
+
| 10240 | 0.0660 µs | 0.0851 µs | 0.0690 µs | 249 B | 15,143,369 |
|
|
951
|
+
|
|
952
|
+
### `validators.email()`
|
|
953
|
+
|
|
954
|
+
**Why we benchmark it.** Checks that a contact variable looks like an email address. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
955
|
+
|
|
956
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.email(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
957
|
+
|
|
958
|
+
**Expected growth: O(n).** Matching scans the local part and domain once with a bounded pattern, so cost follows the length of the address.
|
|
959
|
+
|
|
960
|
+
**Variables that could change its cost**
|
|
961
|
+
|
|
962
|
+
| Variable | How it is handled | What it is |
|
|
963
|
+
| --- | --- | --- |
|
|
964
|
+
| input size | swept | Length of the part before the @, in characters. |
|
|
965
|
+
| input content | fixed at "a long local part at example.com" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
966
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
967
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
968
|
+
|
|
969
|
+
**Deliberately not covered**
|
|
970
|
+
|
|
971
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
972
|
+
|
|
973
|
+
**Measured: O(n)** (exponent 0.68, 10 sizes) -- ✅ matches.
|
|
974
|
+
|
|
975
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
976
|
+
| --- | --- | --- | --- | --- | --- |
|
|
977
|
+
| 20 | 0.400 µs | 0.434 µs | 0.474 µs | 449 B | 2,499,671 |
|
|
978
|
+
| 40 | 0.407 µs | 0.434 µs | 0.500 µs | 448 B | 2,456,097 |
|
|
979
|
+
| 80 | 0.265 µs | 0.471 µs | 0.350 µs | 264 B | 3,767,898 |
|
|
980
|
+
| 160 | 0.555 µs | 1.20 µs | 0.692 µs | 457 B | 1,800,305 |
|
|
981
|
+
| 320 | 0.636 µs | 0.660 µs | 0.750 µs | 452 B | 1,572,327 |
|
|
982
|
+
| 640 | 0.941 µs | 1.34 µs | 1.00 µs | 448 B | 1,062,191 |
|
|
983
|
+
| 1280 | 1.32 µs | 1.45 µs | 2.74 µs | 250 B | 759,340 |
|
|
984
|
+
| 2560 | 1.87 µs | 1.95 µs | 5.80 µs | 249 B | 534,210 |
|
|
985
|
+
| 5120 | 3.28 µs | 3.49 µs | 8.75 µs | 250 B | 304,997 |
|
|
986
|
+
| 10240 | 6.24 µs | 6.43 µs | 15.8 µs | 252 B | 160,326 |
|
|
987
|
+
|
|
988
|
+
### `validators.endsWith(suffix)`
|
|
989
|
+
|
|
990
|
+
**Why we benchmark it.** Requires a value to end with a fixed suffix (a required domain). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
991
|
+
|
|
992
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.endsWith(suffix). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
993
|
+
|
|
994
|
+
**Expected growth: O(1).** Checking a suffix compares only the last few characters, regardless of how long the string is.
|
|
995
|
+
|
|
996
|
+
**Variables that could change its cost**
|
|
997
|
+
|
|
998
|
+
| Variable | How it is handled | What it is |
|
|
999
|
+
| --- | --- | --- |
|
|
1000
|
+
| input size | swept | Length of the string; the comparison only touches the suffix. |
|
|
1001
|
+
| input content | fixed at "a long string ending in .com" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1002
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1003
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1004
|
+
|
|
1005
|
+
**Deliberately not covered**
|
|
1006
|
+
|
|
1007
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1008
|
+
|
|
1009
|
+
**Measured: O(1)** (exponent 0.02, 10 sizes) -- ✅ matches.
|
|
1010
|
+
|
|
1011
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1012
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1013
|
+
| 20 | 0.0884 µs | 0.204 µs | 0.0982 µs | 305 B | 11,313,131 |
|
|
1014
|
+
| 40 | 0.0886 µs | 0.106 µs | 0.0911 µs | 305 B | 11,286,310 |
|
|
1015
|
+
| 80 | 0.0886 µs | 0.112 µs | 0.0916 µs | 305 B | 11,288,654 |
|
|
1016
|
+
| 160 | 0.0922 µs | 0.114 µs | 0.0949 µs | 305 B | 10,850,742 |
|
|
1017
|
+
| 320 | 0.0879 µs | 0.108 µs | 0.0898 µs | 304 B | 11,379,999 |
|
|
1018
|
+
| 640 | 0.0886 µs | 0.101 µs | 0.0909 µs | 304 B | 11,280,422 |
|
|
1019
|
+
| 1280 | 0.0904 µs | 0.113 µs | 0.0939 µs | 305 B | 11,067,614 |
|
|
1020
|
+
| 2560 | 0.0891 µs | 0.106 µs | 0.0918 µs | 305 B | 11,220,609 |
|
|
1021
|
+
| 5120 | 0.0894 µs | 0.105 µs | 0.0912 µs | 304 B | 11,187,523 |
|
|
1022
|
+
| 10240 | 0.0951 µs | 0.124 µs | 0.0979 µs | 305 B | 10,512,336 |
|
|
1023
|
+
|
|
1024
|
+
### `validators.finite()`
|
|
1025
|
+
|
|
1026
|
+
**Why we benchmark it.** Rejects NaN and infinity in a numeric variable. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1027
|
+
|
|
1028
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.finite(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1029
|
+
|
|
1030
|
+
**Expected growth: O(1).** It checks one number.
|
|
1031
|
+
|
|
1032
|
+
**Variables that could change its cost**
|
|
1033
|
+
|
|
1034
|
+
| Variable | How it is handled | What it is |
|
|
1035
|
+
| --- | --- | --- |
|
|
1036
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1037
|
+
| input content | fixed at "a finite decimal" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1038
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1039
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1040
|
+
|
|
1041
|
+
**Deliberately not covered**
|
|
1042
|
+
|
|
1043
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1044
|
+
|
|
1045
|
+
**Measured: O(1)** (exponent 0.01, 10 sizes) -- ✅ matches.
|
|
1046
|
+
|
|
1047
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1048
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1049
|
+
| 20 | 0.0745 µs | 0.103 µs | 0.0799 µs | 305 B | 13,424,418 |
|
|
1050
|
+
| 40 | 0.0722 µs | 0.0870 µs | 0.0747 µs | 305 B | 13,848,504 |
|
|
1051
|
+
| 80 | 0.0691 µs | 0.0846 µs | 0.0717 µs | 304 B | 14,467,786 |
|
|
1052
|
+
| 160 | 0.0697 µs | 0.0950 µs | 0.0731 µs | 305 B | 14,345,630 |
|
|
1053
|
+
| 320 | 0.0711 µs | 0.0966 µs | 0.0741 µs | 304 B | 14,058,692 |
|
|
1054
|
+
| 640 | 0.0694 µs | 0.0966 µs | 0.0715 µs | 304 B | 14,408,417 |
|
|
1055
|
+
| 1280 | 0.0697 µs | 0.0809 µs | 0.0715 µs | 304 B | 14,349,424 |
|
|
1056
|
+
| 2560 | 0.0692 µs | 0.102 µs | 0.0714 µs | 304 B | 14,452,256 |
|
|
1057
|
+
| 5120 | 0.0693 µs | 0.0982 µs | 0.0710 µs | 304 B | 14,439,978 |
|
|
1058
|
+
| 10240 | 0.0710 µs | 0.0987 µs | 0.0739 µs | 305 B | 14,090,620 |
|
|
1059
|
+
|
|
1060
|
+
### `validators.future()`
|
|
1061
|
+
|
|
1062
|
+
**Why we benchmark it.** Requires a date to still lie ahead (a certificate that must not already have expired). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1063
|
+
|
|
1064
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.future(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1065
|
+
|
|
1066
|
+
**Expected growth: O(1).** It compares one timestamp with the current time.
|
|
1067
|
+
|
|
1068
|
+
**Variables that could change its cost**
|
|
1069
|
+
|
|
1070
|
+
| Variable | How it is handled | What it is |
|
|
1071
|
+
| --- | --- | --- |
|
|
1072
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one date. |
|
|
1073
|
+
| input content | fixed at "a date far in the future" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1074
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1075
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1076
|
+
|
|
1077
|
+
**Deliberately not covered**
|
|
1078
|
+
|
|
1079
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1080
|
+
|
|
1081
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
1082
|
+
|
|
1083
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1084
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1085
|
+
| 20 | 0.271 µs | 0.303 µs | 0.276 µs | 417 B | 3,695,583 |
|
|
1086
|
+
| 40 | 0.273 µs | 0.302 µs | 0.279 µs | 417 B | 3,658,922 |
|
|
1087
|
+
| 80 | 0.273 µs | 0.304 µs | 0.278 µs | 417 B | 3,660,731 |
|
|
1088
|
+
| 160 | 0.271 µs | 0.311 µs | 0.276 µs | 417 B | 3,694,132 |
|
|
1089
|
+
| 320 | 0.274 µs | 0.310 µs | 0.279 µs | 417 B | 3,655,978 |
|
|
1090
|
+
| 640 | 0.272 µs | 0.298 µs | 0.278 µs | 417 B | 3,671,708 |
|
|
1091
|
+
| 1280 | 0.270 µs | 0.310 µs | 0.277 µs | 417 B | 3,706,840 |
|
|
1092
|
+
| 2560 | 0.274 µs | 0.297 µs | 0.277 µs | 417 B | 3,655,711 |
|
|
1093
|
+
| 5120 | 0.271 µs | 0.297 µs | 0.274 µs | 417 B | 3,689,290 |
|
|
1094
|
+
| 10240 | 0.272 µs | 0.310 µs | 0.276 µs | 417 B | 3,679,519 |
|
|
1095
|
+
|
|
1096
|
+
### `validators.includes(text)`
|
|
1097
|
+
|
|
1098
|
+
**Why we benchmark it.** Requires a value to contain a fixed substring. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1099
|
+
|
|
1100
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.includes(text). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1101
|
+
|
|
1102
|
+
**Expected growth: O(1).** A substring search scans the string, but the engine's native search is so fast that over the lengths measured the per-call overhead dominates and the curve is flat; it would turn linear only for strings far longer than a real environment value.
|
|
1103
|
+
|
|
1104
|
+
**Variables that could change its cost**
|
|
1105
|
+
|
|
1106
|
+
| Variable | How it is handled | What it is |
|
|
1107
|
+
| --- | --- | --- |
|
|
1108
|
+
| input size | swept | Length of the string, in characters. |
|
|
1109
|
+
| input content | fixed at "a long string made of near-misses of the substring (\"exampl\" repeated) with the real match at the end, so the search cannot skip ahead" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1110
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1111
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1112
|
+
|
|
1113
|
+
**Deliberately not covered**
|
|
1114
|
+
|
|
1115
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1116
|
+
|
|
1117
|
+
**Measured: O(1)** (exponent 0.15, 10 sizes) -- ✅ matches.
|
|
1118
|
+
|
|
1119
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1120
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1121
|
+
| 20 | 0.0889 µs | 0.123 µs | 0.0932 µs | 305 B | 11,251,869 |
|
|
1122
|
+
| 40 | 0.0894 µs | 0.124 µs | 0.0932 µs | 305 B | 11,186,425 |
|
|
1123
|
+
| 80 | 0.0890 µs | 0.106 µs | 0.0913 µs | 305 B | 11,240,408 |
|
|
1124
|
+
| 160 | 0.0909 µs | 0.125 µs | 0.0938 µs | 305 B | 11,005,493 |
|
|
1125
|
+
| 320 | 0.0923 µs | 0.128 µs | 0.0958 µs | 305 B | 10,833,503 |
|
|
1126
|
+
| 640 | 0.0951 µs | 0.129 µs | 0.0990 µs | 305 B | 10,511,417 |
|
|
1127
|
+
| 1280 | 0.103 µs | 0.140 µs | 0.106 µs | 305 B | 9,693,958 |
|
|
1128
|
+
| 2560 | 0.109 µs | 0.147 µs | 0.113 µs | 305 B | 9,200,700 |
|
|
1129
|
+
| 5120 | 0.121 µs | 0.166 µs | 0.125 µs | 305 B | 8,239,114 |
|
|
1130
|
+
| 10240 | 0.146 µs | 0.196 µs | 0.151 µs | 305 B | 6,857,225 |
|
|
1131
|
+
|
|
1132
|
+
### `validators.integer()`
|
|
1133
|
+
|
|
1134
|
+
**Why we benchmark it.** Requires a number to be a whole number. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1135
|
+
|
|
1136
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.integer(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1137
|
+
|
|
1138
|
+
**Expected growth: O(1).** It checks one number.
|
|
1139
|
+
|
|
1140
|
+
**Variables that could change its cost**
|
|
1141
|
+
|
|
1142
|
+
| Variable | How it is handled | What it is |
|
|
1143
|
+
| --- | --- | --- |
|
|
1144
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1145
|
+
| input content | fixed at "the number 42" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1146
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1147
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1148
|
+
|
|
1149
|
+
**Deliberately not covered**
|
|
1150
|
+
|
|
1151
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1152
|
+
|
|
1153
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
1154
|
+
|
|
1155
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1156
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1157
|
+
| 20 | 0.0715 µs | 0.0966 µs | 0.0738 µs | 305 B | 13,986,014 |
|
|
1158
|
+
| 40 | 0.0707 µs | 0.101 µs | 0.0734 µs | 305 B | 14,135,824 |
|
|
1159
|
+
| 80 | 0.0696 µs | 0.0835 µs | 0.0719 µs | 304 B | 14,365,604 |
|
|
1160
|
+
| 160 | 0.0708 µs | 0.0741 µs | 0.0744 µs | 305 B | 14,118,115 |
|
|
1161
|
+
| 320 | 0.0694 µs | 0.0950 µs | 0.0712 µs | 304 B | 14,410,752 |
|
|
1162
|
+
| 640 | 0.0698 µs | 0.0848 µs | 0.0719 µs | 304 B | 14,329,600 |
|
|
1163
|
+
| 1280 | 0.0713 µs | 0.0873 µs | 0.0756 µs | 305 B | 14,030,728 |
|
|
1164
|
+
| 2560 | 0.0700 µs | 0.0844 µs | 0.0726 µs | 304 B | 14,294,185 |
|
|
1165
|
+
| 5120 | 0.0692 µs | 0.0849 µs | 0.0713 µs | 304 B | 14,445,067 |
|
|
1166
|
+
| 10240 | 0.0720 µs | 0.0884 µs | 0.0751 µs | 304 B | 13,894,257 |
|
|
1167
|
+
|
|
1168
|
+
### `validators.length(n)`
|
|
1169
|
+
|
|
1170
|
+
**Why we benchmark it.** Requires a string to have an exact length (a fixed-width token). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1171
|
+
|
|
1172
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.length(n). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1173
|
+
|
|
1174
|
+
**Expected growth: O(1).** A string's length is stored, so reading it costs the same for any string.
|
|
1175
|
+
|
|
1176
|
+
**Variables that could change its cost**
|
|
1177
|
+
|
|
1178
|
+
| Variable | How it is handled | What it is |
|
|
1179
|
+
| --- | --- | --- |
|
|
1180
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always a five-character string. |
|
|
1181
|
+
| input content | fixed at "a five-character string" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1182
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1183
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1184
|
+
|
|
1185
|
+
**Deliberately not covered**
|
|
1186
|
+
|
|
1187
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1188
|
+
|
|
1189
|
+
**Measured: O(1)** (exponent -0.01, 10 sizes) -- ✅ matches.
|
|
1190
|
+
|
|
1191
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1192
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1193
|
+
| 20 | 0.0715 µs | 0.0903 µs | 0.0738 µs | 305 B | 13,993,003 |
|
|
1194
|
+
| 40 | 0.0697 µs | 0.0868 µs | 0.0723 µs | 304 B | 14,338,419 |
|
|
1195
|
+
| 80 | 0.0704 µs | 0.0884 µs | 0.0739 µs | 305 B | 14,213,028 |
|
|
1196
|
+
| 160 | 0.0711 µs | 0.0915 µs | 0.0756 µs | 305 B | 14,056,286 |
|
|
1197
|
+
| 320 | 0.0695 µs | 0.0932 µs | 0.0715 µs | 304 B | 14,379,488 |
|
|
1198
|
+
| 640 | 0.0702 µs | 0.0865 µs | 0.0729 µs | 305 B | 14,247,448 |
|
|
1199
|
+
| 1280 | 0.0740 µs | 0.0904 µs | 0.0772 µs | 304 B | 13,521,807 |
|
|
1200
|
+
| 2560 | 0.0701 µs | 0.0874 µs | 0.0724 µs | 304 B | 14,270,077 |
|
|
1201
|
+
| 5120 | 0.0701 µs | 0.0816 µs | 0.0720 µs | 304 B | 14,271,270 |
|
|
1202
|
+
| 10240 | 0.0706 µs | 0.0916 µs | 0.0733 µs | 305 B | 14,156,365 |
|
|
1203
|
+
|
|
1204
|
+
### `validators.matches(regex)`
|
|
1205
|
+
|
|
1206
|
+
**Why we benchmark it.** Requires a value to match a pattern (a naming convention). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1207
|
+
|
|
1208
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.matches(regex), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1209
|
+
|
|
1210
|
+
**Expected growth: O(n).** A simple anchored character-class pattern examines each character once, so cost follows the length of the input.
|
|
1211
|
+
|
|
1212
|
+
**Variables that could change its cost**
|
|
1213
|
+
|
|
1214
|
+
| Variable | How it is handled | What it is |
|
|
1215
|
+
| --- | --- | --- |
|
|
1216
|
+
| input size | swept | Length of the string, in characters. |
|
|
1217
|
+
| input content | fixed at "a long run of lower-case letters" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1218
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1219
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1220
|
+
|
|
1221
|
+
**Deliberately not covered**
|
|
1222
|
+
|
|
1223
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1224
|
+
|
|
1225
|
+
**Measured: O(n)** (exponent 0.71, 10 sizes) -- ✅ matches.
|
|
1226
|
+
|
|
1227
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1228
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1229
|
+
| 20 | 0.177 µs | 0.229 µs | 0.250 µs | 317 B | 5,637,773 |
|
|
1230
|
+
| 40 | 0.184 µs | 0.217 µs | 0.240 µs | 317 B | 5,426,525 |
|
|
1231
|
+
| 80 | 0.214 µs | 0.578 µs | 0.280 µs | 317 B | 4,665,920 |
|
|
1232
|
+
| 160 | 0.264 µs | 0.290 µs | 0.308 µs | 316 B | 3,784,571 |
|
|
1233
|
+
| 320 | 0.378 µs | 0.456 µs | 0.450 µs | 320 B | 2,644,803 |
|
|
1234
|
+
| 640 | 0.498 µs | 0.647 µs | 0.541 µs | 313 B | 2,009,996 |
|
|
1235
|
+
| 1280 | 0.845 µs | 1.02 µs | 1.78 µs | 305 B | 1,183,167 |
|
|
1236
|
+
| 2560 | 1.29 µs | 1.61 µs | 4.68 µs | 305 B | 775,777 |
|
|
1237
|
+
| 5120 | 2.00 µs | 2.12 µs | 6.08 µs | 305 B | 499,542 |
|
|
1238
|
+
| 10240 | 3.76 µs | 4.08 µs | 10.9 µs | 307 B | 266,125 |
|
|
1239
|
+
|
|
1240
|
+
### `validators.max(limit)`
|
|
1241
|
+
|
|
1242
|
+
**Why we benchmark it.** Caps a number (a pool size). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1243
|
+
|
|
1244
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.max(limit). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1245
|
+
|
|
1246
|
+
**Expected growth: O(1).** It compares two numbers.
|
|
1247
|
+
|
|
1248
|
+
**Variables that could change its cost**
|
|
1249
|
+
|
|
1250
|
+
| Variable | How it is handled | What it is |
|
|
1251
|
+
| --- | --- | --- |
|
|
1252
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1253
|
+
| input content | fixed at "a number under the cap" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1254
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1255
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1256
|
+
|
|
1257
|
+
**Deliberately not covered**
|
|
1258
|
+
|
|
1259
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1260
|
+
|
|
1261
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
1262
|
+
|
|
1263
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1264
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1265
|
+
| 20 | 0.0700 µs | 0.0806 µs | 0.0724 µs | 304 B | 14,290,124 |
|
|
1266
|
+
| 40 | 0.0698 µs | 0.0808 µs | 0.0721 µs | 304 B | 14,331,117 |
|
|
1267
|
+
| 80 | 0.0702 µs | 0.0816 µs | 0.0716 µs | 304 B | 14,250,961 |
|
|
1268
|
+
| 160 | 0.0695 µs | 0.0829 µs | 0.0726 µs | 304 B | 14,395,393 |
|
|
1269
|
+
| 320 | 0.0700 µs | 0.0803 µs | 0.0713 µs | 304 B | 14,295,197 |
|
|
1270
|
+
| 640 | 0.0703 µs | 0.0761 µs | 0.0736 µs | 305 B | 14,221,315 |
|
|
1271
|
+
| 1280 | 0.0707 µs | 0.0844 µs | 0.0730 µs | 304 B | 14,148,366 |
|
|
1272
|
+
| 2560 | 0.0699 µs | 0.0803 µs | 0.0712 µs | 304 B | 14,308,497 |
|
|
1273
|
+
| 5120 | 0.0714 µs | 0.0806 µs | 0.0737 µs | 304 B | 14,007,547 |
|
|
1274
|
+
| 10240 | 0.0707 µs | 0.0796 µs | 0.0734 µs | 305 B | 14,135,626 |
|
|
1275
|
+
|
|
1276
|
+
### `validators.maxItems(limit)`
|
|
1277
|
+
|
|
1278
|
+
**Why we benchmark it.** Caps the length of a list variable. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1279
|
+
|
|
1280
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.maxItems(limit). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1281
|
+
|
|
1282
|
+
**Expected growth: O(1).** An array's length is stored, so checking it costs the same for any array.
|
|
1283
|
+
|
|
1284
|
+
**Variables that could change its cost**
|
|
1285
|
+
|
|
1286
|
+
| Variable | How it is handled | What it is |
|
|
1287
|
+
| --- | --- | --- |
|
|
1288
|
+
| input size | swept | Length of the array; the check only reads the stored length. |
|
|
1289
|
+
| input content | fixed at "a short array" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1290
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1291
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1292
|
+
|
|
1293
|
+
**Deliberately not covered**
|
|
1294
|
+
|
|
1295
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1296
|
+
|
|
1297
|
+
**Measured: O(1)** (exponent -0.00, 10 sizes) -- ✅ matches.
|
|
1298
|
+
|
|
1299
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1300
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1301
|
+
| 20 | 0.0694 µs | 0.0866 µs | 0.0722 µs | 304 B | 14,415,830 |
|
|
1302
|
+
| 40 | 0.0698 µs | 0.0856 µs | 0.0716 µs | 304 B | 14,327,008 |
|
|
1303
|
+
| 80 | 0.0695 µs | 0.0898 µs | 0.0720 µs | 304 B | 14,397,215 |
|
|
1304
|
+
| 160 | 0.0713 µs | 0.0905 µs | 0.0752 µs | 305 B | 14,034,347 |
|
|
1305
|
+
| 320 | 0.0713 µs | 0.0907 µs | 0.0735 µs | 304 B | 14,021,618 |
|
|
1306
|
+
| 640 | 0.0709 µs | 0.0932 µs | 0.0746 µs | 305 B | 14,113,699 |
|
|
1307
|
+
| 1280 | 0.0700 µs | 0.0867 µs | 0.0730 µs | 305 B | 14,288,130 |
|
|
1308
|
+
| 2560 | 0.0696 µs | 0.0866 µs | 0.0720 µs | 304 B | 14,364,664 |
|
|
1309
|
+
| 5120 | 0.0697 µs | 0.0867 µs | 0.0716 µs | 304 B | 14,348,045 |
|
|
1310
|
+
| 10240 | 0.0699 µs | 0.0769 µs | 0.0713 µs | 304 B | 14,301,908 |
|
|
1311
|
+
|
|
1312
|
+
### `validators.maxLength(limit)`
|
|
1313
|
+
|
|
1314
|
+
**Why we benchmark it.** Caps the length of a string. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1315
|
+
|
|
1316
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.maxLength(limit). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1317
|
+
|
|
1318
|
+
**Expected growth: O(1).** A string's length is stored, so checking it costs the same for any string.
|
|
1319
|
+
|
|
1320
|
+
**Variables that could change its cost**
|
|
1321
|
+
|
|
1322
|
+
| Variable | How it is handled | What it is |
|
|
1323
|
+
| --- | --- | --- |
|
|
1324
|
+
| input size | swept | Length of the string; the check only reads the stored length. |
|
|
1325
|
+
| input content | fixed at "a string within the cap" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1326
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1327
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1328
|
+
|
|
1329
|
+
**Deliberately not covered**
|
|
1330
|
+
|
|
1331
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1332
|
+
|
|
1333
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
1334
|
+
|
|
1335
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1336
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1337
|
+
| 20 | 0.0703 µs | 0.0929 µs | 0.0737 µs | 305 B | 14,232,162 |
|
|
1338
|
+
| 40 | 0.0712 µs | 0.0896 µs | 0.0739 µs | 305 B | 14,039,970 |
|
|
1339
|
+
| 80 | 0.0698 µs | 0.0861 µs | 0.0718 µs | 304 B | 14,323,586 |
|
|
1340
|
+
| 160 | 0.0703 µs | 0.0888 µs | 0.0735 µs | 305 B | 14,223,099 |
|
|
1341
|
+
| 320 | 0.0700 µs | 0.0867 µs | 0.0717 µs | 304 B | 14,279,968 |
|
|
1342
|
+
| 640 | 0.0699 µs | 0.0877 µs | 0.0728 µs | 304 B | 14,309,764 |
|
|
1343
|
+
| 1280 | 0.0697 µs | 0.0869 µs | 0.0708 µs | 304 B | 14,341,750 |
|
|
1344
|
+
| 2560 | 0.0698 µs | 0.0871 µs | 0.0714 µs | 304 B | 14,326,455 |
|
|
1345
|
+
| 5120 | 0.0706 µs | 0.0893 µs | 0.0726 µs | 305 B | 14,158,276 |
|
|
1346
|
+
| 10240 | 0.0702 µs | 0.0866 µs | 0.0731 µs | 305 B | 14,254,256 |
|
|
1347
|
+
|
|
1348
|
+
### `validators.min(limit)`
|
|
1349
|
+
|
|
1350
|
+
**Why we benchmark it.** Sets a floor for a number. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1351
|
+
|
|
1352
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.min(limit). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1353
|
+
|
|
1354
|
+
**Expected growth: O(1).** It compares two numbers.
|
|
1355
|
+
|
|
1356
|
+
**Variables that could change its cost**
|
|
1357
|
+
|
|
1358
|
+
| Variable | How it is handled | What it is |
|
|
1359
|
+
| --- | --- | --- |
|
|
1360
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1361
|
+
| input content | fixed at "a number above the floor" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1362
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1363
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1364
|
+
|
|
1365
|
+
**Deliberately not covered**
|
|
1366
|
+
|
|
1367
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1368
|
+
|
|
1369
|
+
**Measured: O(1)** (exponent -0.00, 10 sizes) -- ✅ matches.
|
|
1370
|
+
|
|
1371
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1372
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1373
|
+
| 20 | 0.0695 µs | 0.0801 µs | 0.0710 µs | 304 B | 14,378,271 |
|
|
1374
|
+
| 40 | 0.0697 µs | 0.0797 µs | 0.0715 µs | 304 B | 14,354,207 |
|
|
1375
|
+
| 80 | 0.0696 µs | 0.0848 µs | 0.0727 µs | 305 B | 14,359,892 |
|
|
1376
|
+
| 160 | 0.0698 µs | 0.0780 µs | 0.0713 µs | 304 B | 14,328,961 |
|
|
1377
|
+
| 320 | 0.0695 µs | 0.0836 µs | 0.0713 µs | 304 B | 14,379,833 |
|
|
1378
|
+
| 640 | 0.0701 µs | 0.0871 µs | 0.0722 µs | 305 B | 14,274,943 |
|
|
1379
|
+
| 1280 | 0.0697 µs | 0.0844 µs | 0.0715 µs | 304 B | 14,349,424 |
|
|
1380
|
+
| 2560 | 0.0703 µs | 0.0811 µs | 0.0718 µs | 304 B | 14,222,778 |
|
|
1381
|
+
| 5120 | 0.0697 µs | 0.0765 µs | 0.0719 µs | 305 B | 14,342,935 |
|
|
1382
|
+
| 10240 | 0.0699 µs | 0.0804 µs | 0.0720 µs | 304 B | 14,299,713 |
|
|
1383
|
+
|
|
1384
|
+
### `validators.minItems(limit)`
|
|
1385
|
+
|
|
1386
|
+
**Why we benchmark it.** Requires a list variable to have at least some entries. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1387
|
+
|
|
1388
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.minItems(limit). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1389
|
+
|
|
1390
|
+
**Expected growth: O(1).** An array's length is stored, so checking it costs the same for any array.
|
|
1391
|
+
|
|
1392
|
+
**Variables that could change its cost**
|
|
1393
|
+
|
|
1394
|
+
| Variable | How it is handled | What it is |
|
|
1395
|
+
| --- | --- | --- |
|
|
1396
|
+
| input size | swept | Length of the array; the check only reads the stored length. |
|
|
1397
|
+
| input content | fixed at "an array above the floor" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1398
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1399
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1400
|
+
|
|
1401
|
+
**Deliberately not covered**
|
|
1402
|
+
|
|
1403
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1404
|
+
|
|
1405
|
+
**Measured: O(1)** (exponent -0.01, 10 sizes) -- ✅ matches.
|
|
1406
|
+
|
|
1407
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1408
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1409
|
+
| 20 | 0.0702 µs | 0.0871 µs | 0.0729 µs | 304 B | 14,254,774 |
|
|
1410
|
+
| 40 | 0.0692 µs | 0.0863 µs | 0.0714 µs | 304 B | 14,441,974 |
|
|
1411
|
+
| 80 | 0.0703 µs | 0.0887 µs | 0.0729 µs | 305 B | 14,219,851 |
|
|
1412
|
+
| 160 | 0.0715 µs | 0.0908 µs | 0.0738 µs | 305 B | 13,990,142 |
|
|
1413
|
+
| 320 | 0.0712 µs | 0.0914 µs | 0.0756 µs | 305 B | 14,041,000 |
|
|
1414
|
+
| 640 | 0.0709 µs | 0.0905 µs | 0.0727 µs | 305 B | 14,097,635 |
|
|
1415
|
+
| 1280 | 0.0732 µs | 0.0863 µs | 0.0756 µs | 304 B | 13,657,056 |
|
|
1416
|
+
| 2560 | 0.0703 µs | 0.0885 µs | 0.0727 µs | 305 B | 14,222,091 |
|
|
1417
|
+
| 5120 | 0.0690 µs | 0.0840 µs | 0.0721 µs | 304 B | 14,495,534 |
|
|
1418
|
+
| 10240 | 0.0695 µs | 0.0818 µs | 0.0716 µs | 304 B | 14,387,581 |
|
|
1419
|
+
|
|
1420
|
+
### `validators.minLength(limit)`
|
|
1421
|
+
|
|
1422
|
+
**Why we benchmark it.** Requires a string to be at least some length (a minimum secret length). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1423
|
+
|
|
1424
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.minLength(limit). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1425
|
+
|
|
1426
|
+
**Expected growth: O(1).** A string's length is stored, so checking it costs the same for any string.
|
|
1427
|
+
|
|
1428
|
+
**Variables that could change its cost**
|
|
1429
|
+
|
|
1430
|
+
| Variable | How it is handled | What it is |
|
|
1431
|
+
| --- | --- | --- |
|
|
1432
|
+
| input size | swept | Length of the string; the check only reads the stored length. |
|
|
1433
|
+
| input content | fixed at "a string above the floor" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1434
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1435
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1436
|
+
|
|
1437
|
+
**Deliberately not covered**
|
|
1438
|
+
|
|
1439
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1440
|
+
|
|
1441
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1442
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1443
|
+
| 20 | 0.0715 µs | 0.0921 µs | 0.0756 µs | 305 B | 13,976,955 |
|
|
1444
|
+
| 40 | 0.0733 µs | 0.0916 µs | 0.0772 µs | 305 B | 13,639,064 |
|
|
1445
|
+
| 80 | 0.0709 µs | 0.0888 µs | 0.0732 µs | 304 B | 14,108,385 |
|
|
1446
|
+
| 160 | 0.0709 µs | 0.0896 µs | 0.0732 µs | 305 B | 14,100,249 |
|
|
1447
|
+
| 320 | 0.0707 µs | 0.0932 µs | 0.0733 µs | 305 B | 14,135,027 |
|
|
1448
|
+
| 640 | 0.0698 µs | 0.0831 µs | 0.0715 µs | 304 B | 14,336,049 |
|
|
1449
|
+
| 1280 | 0.119 µs | 0.132 µs | 0.150 µs | 312 B | 8,406,894 |
|
|
1450
|
+
| 2560 | 0.0696 µs | 0.0831 µs | 0.0710 µs | 304 B | 14,374,350 |
|
|
1451
|
+
| 5120 | 0.0711 µs | 0.0887 µs | 0.0734 µs | 305 B | 14,069,970 |
|
|
1452
|
+
| 10240 | 0.0715 µs | 0.0885 µs | 0.0736 µs | 304 B | 13,982,982 |
|
|
1453
|
+
|
|
1454
|
+
### `validators.negative()`
|
|
1455
|
+
|
|
1456
|
+
**Why we benchmark it.** Requires a number to be below zero. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1457
|
+
|
|
1458
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.negative(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1459
|
+
|
|
1460
|
+
**Expected growth: O(1).** It compares one number with zero.
|
|
1461
|
+
|
|
1462
|
+
**Variables that could change its cost**
|
|
1463
|
+
|
|
1464
|
+
| Variable | How it is handled | What it is |
|
|
1465
|
+
| --- | --- | --- |
|
|
1466
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1467
|
+
| input content | fixed at "a negative number" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1468
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1469
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1470
|
+
|
|
1471
|
+
**Deliberately not covered**
|
|
1472
|
+
|
|
1473
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1474
|
+
|
|
1475
|
+
**Measured: O(1)** (exponent -0.00, 10 sizes) -- ✅ matches.
|
|
1476
|
+
|
|
1477
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1478
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1479
|
+
| 20 | 0.0699 µs | 0.0862 µs | 0.0726 µs | 305 B | 14,297,848 |
|
|
1480
|
+
| 40 | 0.0691 µs | 0.0831 µs | 0.0713 µs | 304 B | 14,466,166 |
|
|
1481
|
+
| 80 | 0.0703 µs | 0.0833 µs | 0.0720 µs | 304 B | 14,225,970 |
|
|
1482
|
+
| 160 | 0.0707 µs | 0.0851 µs | 0.0739 µs | 305 B | 14,143,391 |
|
|
1483
|
+
| 320 | 0.0703 µs | 0.0840 µs | 0.0727 µs | 304 B | 14,216,900 |
|
|
1484
|
+
| 640 | 0.0705 µs | 0.0830 µs | 0.0724 µs | 304 B | 14,189,384 |
|
|
1485
|
+
| 1280 | 0.0711 µs | 0.0830 µs | 0.0737 µs | 304 B | 14,062,205 |
|
|
1486
|
+
| 2560 | 0.0709 µs | 0.0878 µs | 0.0738 µs | 305 B | 14,107,656 |
|
|
1487
|
+
| 5120 | 0.0706 µs | 0.0994 µs | 0.0739 µs | 305 B | 14,154,913 |
|
|
1488
|
+
| 10240 | 0.0702 µs | 0.0840 µs | 0.0730 µs | 304 B | 14,239,258 |
|
|
1489
|
+
|
|
1490
|
+
### `validators.not(validator)`
|
|
1491
|
+
|
|
1492
|
+
**Why we benchmark it.** Inverts another validator (forbid a reserved value). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1493
|
+
|
|
1494
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.not(validator). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1495
|
+
|
|
1496
|
+
**Expected growth: O(1).** It runs the one inner validator and flips its result.
|
|
1497
|
+
|
|
1498
|
+
**Variables that could change its cost**
|
|
1499
|
+
|
|
1500
|
+
| Variable | How it is handled | What it is |
|
|
1501
|
+
| --- | --- | --- |
|
|
1502
|
+
| input size | swept | Varied only to show the wrapper ignores it; the inner check is a single comparison. |
|
|
1503
|
+
| input content | fixed at "a value the inner validator rejects" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1504
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1505
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1506
|
+
|
|
1507
|
+
**Deliberately not covered**
|
|
1508
|
+
|
|
1509
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1510
|
+
|
|
1511
|
+
**Measured: O(1)** (exponent -0.05, 10 sizes) -- ✅ matches.
|
|
1512
|
+
|
|
1513
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1514
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1515
|
+
| 20 | 0.0705 µs | 0.117 µs | 0.0726 µs | 305 B | 14,174,611 |
|
|
1516
|
+
| 40 | 0.0725 µs | 0.142 µs | 0.0771 µs | 305 B | 13,785,086 |
|
|
1517
|
+
| 80 | 0.0705 µs | 0.0863 µs | 0.0726 µs | 305 B | 14,178,168 |
|
|
1518
|
+
| 160 | 0.0709 µs | 0.109 µs | 0.0746 µs | 305 B | 14,096,698 |
|
|
1519
|
+
| 320 | 0.0715 µs | 0.118 µs | 0.0753 µs | 305 B | 13,979,707 |
|
|
1520
|
+
| 640 | 0.0850 µs | 0.0933 µs | 0.105 µs | 308 B | 11,766,527 |
|
|
1521
|
+
| 1280 | 0.0715 µs | 0.0964 µs | 0.0757 µs | 305 B | 13,978,088 |
|
|
1522
|
+
| 2560 | 0.0706 µs | 0.0865 µs | 0.0728 µs | 305 B | 14,161,455 |
|
|
1523
|
+
| 5120 | 0.0710 µs | 0.116 µs | 0.0739 µs | 305 B | 14,083,077 |
|
|
1524
|
+
| 10240 | 0.0707 µs | 0.111 µs | 0.0728 µs | 305 B | 14,145,981 |
|
|
1525
|
+
|
|
1526
|
+
### `validators.oneOf(options)`
|
|
1527
|
+
|
|
1528
|
+
**Why we benchmark it.** Restricts a variable to a fixed set of allowed values (an environment name). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1529
|
+
|
|
1530
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.oneOf(options), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1531
|
+
|
|
1532
|
+
**Expected growth: O(n).** It searches the allowed values for a match, so with the matching option last, cost is proportional to how many options there are.
|
|
1533
|
+
|
|
1534
|
+
**Variables that could change its cost**
|
|
1535
|
+
|
|
1536
|
+
| Variable | How it is handled | What it is |
|
|
1537
|
+
| --- | --- | --- |
|
|
1538
|
+
| input size | swept | Number of allowed options; the input matches the last one. |
|
|
1539
|
+
| input content | fixed at "the final option of the list" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1540
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1541
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1542
|
+
|
|
1543
|
+
**Deliberately not covered**
|
|
1544
|
+
|
|
1545
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1546
|
+
|
|
1547
|
+
**Measured: O(n)** (exponent 0.82, 10 sizes) -- ✅ matches.
|
|
1548
|
+
|
|
1549
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1550
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1551
|
+
| 20 | 0.114 µs | 0.144 µs | 0.118 µs | 305 B | 8,743,806 |
|
|
1552
|
+
| 40 | 0.174 µs | 0.212 µs | 0.178 µs | 305 B | 5,745,548 |
|
|
1553
|
+
| 80 | 0.301 µs | 0.325 µs | 0.305 µs | 305 B | 3,320,873 |
|
|
1554
|
+
| 160 | 0.357 µs | 0.398 µs | 0.361 µs | 305 B | 2,800,162 |
|
|
1555
|
+
| 320 | 0.781 µs | 0.825 µs | 2.94 µs | 305 B | 1,280,882 |
|
|
1556
|
+
| 640 | 1.45 µs | 1.74 µs | 4.50 µs | 305 B | 687,644 |
|
|
1557
|
+
| 1280 | 1.69 µs | 1.74 µs | 5.12 µs | 305 B | 592,690 |
|
|
1558
|
+
| 2560 | 4.27 µs | 4.52 µs | 11.0 µs | 306 B | 234,264 |
|
|
1559
|
+
| 5120 | 9.88 µs | 10.1 µs | 24.9 µs | 309 B | 101,215 |
|
|
1560
|
+
| 10240 | 10.2 µs | 10.5 µs | 23.4 µs | 308 B | 98,314 |
|
|
1561
|
+
|
|
1562
|
+
### `validators.optional(validator)`
|
|
1563
|
+
|
|
1564
|
+
**Why we benchmark it.** Allows a variable to be absent while still validating it when present. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1565
|
+
|
|
1566
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.optional(validator). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1567
|
+
|
|
1568
|
+
**Expected growth: O(1).** It checks for absence and otherwise forwards to the one inner validator.
|
|
1569
|
+
|
|
1570
|
+
**Variables that could change its cost**
|
|
1571
|
+
|
|
1572
|
+
| Variable | How it is handled | What it is |
|
|
1573
|
+
| --- | --- | --- |
|
|
1574
|
+
| input size | swept | Varied only to show the wrapper ignores it; the inner check is a single comparison. |
|
|
1575
|
+
| input content | fixed at "a present value the inner validator accepts" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1576
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1577
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1578
|
+
|
|
1579
|
+
**Deliberately not covered**
|
|
1580
|
+
|
|
1581
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1582
|
+
|
|
1583
|
+
**Measured: O(1)** (exponent -0.00, 10 sizes) -- ✅ matches.
|
|
1584
|
+
|
|
1585
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1586
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1587
|
+
| 20 | 0.0715 µs | 0.103 µs | 0.0745 µs | 305 B | 13,981,462 |
|
|
1588
|
+
| 40 | 0.0704 µs | 0.0839 µs | 0.0728 µs | 304 B | 14,211,528 |
|
|
1589
|
+
| 80 | 0.0708 µs | 0.0980 µs | 0.0732 µs | 305 B | 14,129,053 |
|
|
1590
|
+
| 160 | 0.0707 µs | 0.0963 µs | 0.0724 µs | 304 B | 14,145,130 |
|
|
1591
|
+
| 320 | 0.0708 µs | 0.0946 µs | 0.0735 µs | 304 B | 14,124,022 |
|
|
1592
|
+
| 640 | 0.0705 µs | 0.0900 µs | 0.0719 µs | 304 B | 14,185,871 |
|
|
1593
|
+
| 1280 | 0.0728 µs | 0.0996 µs | 0.0771 µs | 305 B | 13,734,486 |
|
|
1594
|
+
| 2560 | 0.0704 µs | 0.0965 µs | 0.0718 µs | 304 B | 14,202,483 |
|
|
1595
|
+
| 5120 | 0.0709 µs | 0.0960 µs | 0.0735 µs | 304 B | 14,113,174 |
|
|
1596
|
+
| 10240 | 0.0709 µs | 0.100 µs | 0.0737 µs | 305 B | 14,109,347 |
|
|
1597
|
+
|
|
1598
|
+
### `validators.past()`
|
|
1599
|
+
|
|
1600
|
+
**Why we benchmark it.** Requires a date to already have happened. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1601
|
+
|
|
1602
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.past(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1603
|
+
|
|
1604
|
+
**Expected growth: O(1).** It compares one timestamp with the current time.
|
|
1605
|
+
|
|
1606
|
+
**Variables that could change its cost**
|
|
1607
|
+
|
|
1608
|
+
| Variable | How it is handled | What it is |
|
|
1609
|
+
| --- | --- | --- |
|
|
1610
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one date. |
|
|
1611
|
+
| input content | fixed at "a date in the past" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1612
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1613
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1614
|
+
|
|
1615
|
+
**Deliberately not covered**
|
|
1616
|
+
|
|
1617
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1618
|
+
|
|
1619
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
1620
|
+
|
|
1621
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1622
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1623
|
+
| 20 | 0.277 µs | 0.323 µs | 0.284 µs | 418 B | 3,611,578 |
|
|
1624
|
+
| 40 | 0.275 µs | 0.306 µs | 0.279 µs | 417 B | 3,633,686 |
|
|
1625
|
+
| 80 | 0.280 µs | 0.308 µs | 0.284 µs | 417 B | 3,574,530 |
|
|
1626
|
+
| 160 | 0.279 µs | 0.316 µs | 0.282 µs | 417 B | 3,586,006 |
|
|
1627
|
+
| 320 | 0.273 µs | 0.293 µs | 0.278 µs | 417 B | 3,660,503 |
|
|
1628
|
+
| 640 | 0.274 µs | 0.296 µs | 0.278 µs | 417 B | 3,645,479 |
|
|
1629
|
+
| 1280 | 0.273 µs | 0.310 µs | 0.278 µs | 417 B | 3,659,560 |
|
|
1630
|
+
| 2560 | 0.279 µs | 0.315 µs | 0.285 µs | 417 B | 3,584,271 |
|
|
1631
|
+
| 5120 | 0.276 µs | 0.299 µs | 0.281 µs | 417 B | 3,628,384 |
|
|
1632
|
+
| 10240 | 0.275 µs | 0.299 µs | 0.280 µs | 417 B | 3,642,050 |
|
|
1633
|
+
|
|
1634
|
+
### `validators.positive()`
|
|
1635
|
+
|
|
1636
|
+
**Why we benchmark it.** Requires a number to be above zero. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1637
|
+
|
|
1638
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.positive(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1639
|
+
|
|
1640
|
+
**Expected growth: O(1).** It compares one number with zero.
|
|
1641
|
+
|
|
1642
|
+
**Variables that could change its cost**
|
|
1643
|
+
|
|
1644
|
+
| Variable | How it is handled | What it is |
|
|
1645
|
+
| --- | --- | --- |
|
|
1646
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1647
|
+
| input content | fixed at "a positive number" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1648
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1649
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1650
|
+
|
|
1651
|
+
**Deliberately not covered**
|
|
1652
|
+
|
|
1653
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1654
|
+
|
|
1655
|
+
**Measured: O(1)** (exponent 0.01, 10 sizes) -- ✅ matches.
|
|
1656
|
+
|
|
1657
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1658
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1659
|
+
| 20 | 0.0709 µs | 0.0855 µs | 0.0726 µs | 304 B | 14,103,306 |
|
|
1660
|
+
| 40 | 0.0705 µs | 0.0811 µs | 0.0724 µs | 304 B | 14,193,051 |
|
|
1661
|
+
| 80 | 0.0704 µs | 0.0868 µs | 0.0725 µs | 305 B | 14,194,610 |
|
|
1662
|
+
| 160 | 0.0704 µs | 0.0834 µs | 0.0730 µs | 304 B | 14,200,379 |
|
|
1663
|
+
| 320 | 0.0715 µs | 0.0880 µs | 0.0731 µs | 305 B | 13,978,699 |
|
|
1664
|
+
| 640 | 0.0708 µs | 0.0863 µs | 0.0730 µs | 304 B | 14,125,103 |
|
|
1665
|
+
| 1280 | 0.0706 µs | 0.0892 µs | 0.0740 µs | 305 B | 14,155,083 |
|
|
1666
|
+
| 2560 | 0.0717 µs | 0.0850 µs | 0.0730 µs | 304 B | 13,947,923 |
|
|
1667
|
+
| 5120 | 0.0706 µs | 0.0867 µs | 0.0726 µs | 304 B | 14,163,723 |
|
|
1668
|
+
| 10240 | 0.0722 µs | 0.0838 µs | 0.0737 µs | 304 B | 13,844,422 |
|
|
1669
|
+
|
|
1670
|
+
### `validators.range(min, max)`
|
|
1671
|
+
|
|
1672
|
+
**Why we benchmark it.** Requires a number to fall between two bounds (a port range). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1673
|
+
|
|
1674
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.range(min, max). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1675
|
+
|
|
1676
|
+
**Expected growth: O(1).** It compares one number with two bounds.
|
|
1677
|
+
|
|
1678
|
+
**Variables that could change its cost**
|
|
1679
|
+
|
|
1680
|
+
| Variable | How it is handled | What it is |
|
|
1681
|
+
| --- | --- | --- |
|
|
1682
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1683
|
+
| input content | fixed at "a number inside the range" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1684
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1685
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1686
|
+
|
|
1687
|
+
**Deliberately not covered**
|
|
1688
|
+
|
|
1689
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1690
|
+
|
|
1691
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
1692
|
+
|
|
1693
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1694
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1695
|
+
| 20 | 0.0734 µs | 0.0895 µs | 0.0779 µs | 305 B | 13,625,956 |
|
|
1696
|
+
| 40 | 0.0709 µs | 0.0826 µs | 0.0732 µs | 304 B | 14,109,612 |
|
|
1697
|
+
| 80 | 0.0703 µs | 0.0817 µs | 0.0724 µs | 304 B | 14,215,270 |
|
|
1698
|
+
| 160 | 0.0707 µs | 0.0881 µs | 0.0729 µs | 305 B | 14,147,997 |
|
|
1699
|
+
| 320 | 0.0730 µs | 0.0851 µs | 0.0757 µs | 304 B | 13,707,716 |
|
|
1700
|
+
| 640 | 0.0706 µs | 0.0841 µs | 0.0728 µs | 304 B | 14,166,759 |
|
|
1701
|
+
| 1280 | 0.0706 µs | 0.0826 µs | 0.0727 µs | 304 B | 14,167,750 |
|
|
1702
|
+
| 2560 | 0.0710 µs | 0.0869 µs | 0.0733 µs | 305 B | 14,076,156 |
|
|
1703
|
+
| 5120 | 0.0706 µs | 0.0801 µs | 0.0722 µs | 304 B | 14,155,831 |
|
|
1704
|
+
| 10240 | 0.0707 µs | 0.0833 µs | 0.0739 µs | 305 B | 14,144,091 |
|
|
1705
|
+
|
|
1706
|
+
### `validators.refine(validator, message)`
|
|
1707
|
+
|
|
1708
|
+
**Why we benchmark it.** Attaches a custom failure message to another validator. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1709
|
+
|
|
1710
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.refine(validator, message). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1711
|
+
|
|
1712
|
+
**Expected growth: O(1).** It runs the one inner validator and substitutes the message on failure.
|
|
1713
|
+
|
|
1714
|
+
**Variables that could change its cost**
|
|
1715
|
+
|
|
1716
|
+
| Variable | How it is handled | What it is |
|
|
1717
|
+
| --- | --- | --- |
|
|
1718
|
+
| input size | swept | Varied only to show the wrapper ignores it; the inner check is a single comparison. |
|
|
1719
|
+
| input content | fixed at "a value the inner validator accepts" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1720
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1721
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1722
|
+
|
|
1723
|
+
**Deliberately not covered**
|
|
1724
|
+
|
|
1725
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1726
|
+
|
|
1727
|
+
**Measured: O(1)** (exponent -0.01, 10 sizes) -- ✅ matches.
|
|
1728
|
+
|
|
1729
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1730
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1731
|
+
| 20 | 0.0701 µs | 0.115 µs | 0.0717 µs | 305 B | 14,267,539 |
|
|
1732
|
+
| 40 | 0.0713 µs | 0.0868 µs | 0.0730 µs | 304 B | 14,028,266 |
|
|
1733
|
+
| 80 | 0.0726 µs | 0.101 µs | 0.0767 µs | 305 B | 13,783,382 |
|
|
1734
|
+
| 160 | 0.0709 µs | 0.0998 µs | 0.0739 µs | 305 B | 14,101,865 |
|
|
1735
|
+
| 320 | 0.0714 µs | 0.0861 µs | 0.0735 µs | 304 B | 14,013,973 |
|
|
1736
|
+
| 640 | 0.0722 µs | 0.102 µs | 0.0750 µs | 305 B | 13,859,141 |
|
|
1737
|
+
| 1280 | 0.0713 µs | 0.101 µs | 0.0735 µs | 305 B | 14,017,684 |
|
|
1738
|
+
| 2560 | 0.0710 µs | 0.0987 µs | 0.0739 µs | 305 B | 14,085,810 |
|
|
1739
|
+
| 5120 | 0.0714 µs | 0.0914 µs | 0.0738 µs | 305 B | 13,998,405 |
|
|
1740
|
+
| 10240 | 0.0706 µs | 0.0880 µs | 0.0728 µs | 305 B | 14,171,357 |
|
|
1741
|
+
|
|
1742
|
+
### `validators.required()`
|
|
1743
|
+
|
|
1744
|
+
**Why we benchmark it.** Requires a variable to be present and non-empty. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1745
|
+
|
|
1746
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.required(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1747
|
+
|
|
1748
|
+
**Expected growth: O(1).** It checks one value for presence.
|
|
1749
|
+
|
|
1750
|
+
**Variables that could change its cost**
|
|
1751
|
+
|
|
1752
|
+
| Variable | How it is handled | What it is |
|
|
1753
|
+
| --- | --- | --- |
|
|
1754
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always a short value. |
|
|
1755
|
+
| input content | fixed at "a non-empty string" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1756
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1757
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1758
|
+
|
|
1759
|
+
**Deliberately not covered**
|
|
1760
|
+
|
|
1761
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1762
|
+
|
|
1763
|
+
**Measured: O(1)** (exponent 0.00, 10 sizes) -- ✅ matches.
|
|
1764
|
+
|
|
1765
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1766
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1767
|
+
| 20 | 0.0715 µs | 0.0967 µs | 0.0766 µs | 305 B | 13,989,539 |
|
|
1768
|
+
| 40 | 0.0715 µs | 0.0919 µs | 0.0749 µs | 305 B | 13,989,994 |
|
|
1769
|
+
| 80 | 0.0718 µs | 0.0892 µs | 0.0751 µs | 305 B | 13,918,275 |
|
|
1770
|
+
| 160 | 0.0712 µs | 0.0878 µs | 0.0743 µs | 305 B | 14,039,152 |
|
|
1771
|
+
| 320 | 0.0714 µs | 0.0834 µs | 0.0732 µs | 304 B | 14,008,377 |
|
|
1772
|
+
| 640 | 0.0712 µs | 0.0839 µs | 0.0732 µs | 304 B | 14,037,383 |
|
|
1773
|
+
| 1280 | 0.0717 µs | 0.0872 µs | 0.0741 µs | 304 B | 13,940,504 |
|
|
1774
|
+
| 2560 | 0.0712 µs | 0.0842 µs | 0.0731 µs | 304 B | 14,044,098 |
|
|
1775
|
+
| 5120 | 0.0716 µs | 0.0856 µs | 0.0743 µs | 304 B | 13,975,449 |
|
|
1776
|
+
| 10240 | 0.0719 µs | 0.0898 µs | 0.0741 µs | 305 B | 13,915,638 |
|
|
1777
|
+
|
|
1778
|
+
### `validators.safeInteger()`
|
|
1779
|
+
|
|
1780
|
+
**Why we benchmark it.** Requires an integer that a double can represent exactly. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1781
|
+
|
|
1782
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.safeInteger(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1783
|
+
|
|
1784
|
+
**Expected growth: O(1).** It checks one number against fixed bounds.
|
|
1785
|
+
|
|
1786
|
+
**Variables that could change its cost**
|
|
1787
|
+
|
|
1788
|
+
| Variable | How it is handled | What it is |
|
|
1789
|
+
| --- | --- | --- |
|
|
1790
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one number. |
|
|
1791
|
+
| input content | fixed at "a small integer" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1792
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1793
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1794
|
+
|
|
1795
|
+
**Deliberately not covered**
|
|
1796
|
+
|
|
1797
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1798
|
+
|
|
1799
|
+
**Measured: O(1)** (exponent -0.00, 10 sizes) -- ✅ matches.
|
|
1800
|
+
|
|
1801
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1802
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1803
|
+
| 20 | 0.0711 µs | 0.0982 µs | 0.0749 µs | 305 B | 14,065,438 |
|
|
1804
|
+
| 40 | 0.0791 µs | 0.0882 µs | 0.0942 µs | 306 B | 12,640,835 |
|
|
1805
|
+
| 80 | 0.0730 µs | 0.0951 µs | 0.0804 µs | 305 B | 13,703,225 |
|
|
1806
|
+
| 160 | 0.0704 µs | 0.0877 µs | 0.0729 µs | 305 B | 14,196,253 |
|
|
1807
|
+
| 320 | 0.0704 µs | 0.0961 µs | 0.0729 µs | 304 B | 14,197,979 |
|
|
1808
|
+
| 640 | 0.0707 µs | 0.125 µs | 0.0730 µs | 305 B | 14,144,627 |
|
|
1809
|
+
| 1280 | 0.0707 µs | 0.0971 µs | 0.0731 µs | 305 B | 14,147,069 |
|
|
1810
|
+
| 2560 | 0.0713 µs | 0.0999 µs | 0.0744 µs | 305 B | 14,022,515 |
|
|
1811
|
+
| 5120 | 0.0709 µs | 0.101 µs | 0.0734 µs | 305 B | 14,104,833 |
|
|
1812
|
+
| 10240 | 0.0702 µs | 0.0962 µs | 0.0726 µs | 305 B | 14,247,633 |
|
|
1813
|
+
|
|
1814
|
+
### `validators.unique()`
|
|
1815
|
+
|
|
1816
|
+
**Why we benchmark it.** Requires every entry of a list variable to be distinct (no duplicate hosts). It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1817
|
+
|
|
1818
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.unique(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1819
|
+
|
|
1820
|
+
**Expected growth: O(n).** It adds each entry to a set and compares the set's size with the list's, so cost is proportional to the number of entries.
|
|
1821
|
+
|
|
1822
|
+
**Variables that could change its cost**
|
|
1823
|
+
|
|
1824
|
+
| Variable | How it is handled | What it is |
|
|
1825
|
+
| --- | --- | --- |
|
|
1826
|
+
| input size | swept | Number of entries in the list. |
|
|
1827
|
+
| input content | fixed at "a list of distinct integers" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1828
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1829
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1830
|
+
|
|
1831
|
+
**Deliberately not covered**
|
|
1832
|
+
|
|
1833
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1834
|
+
|
|
1835
|
+
**Measured: O(n log n)** (exponent 1.32, 10 sizes) -- 🟡 close (neighbouring class).
|
|
1836
|
+
|
|
1837
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1838
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1839
|
+
| 20 | 0.547 µs | 0.637 µs | 0.555 µs | 1.5 KiB | 1,826,772 |
|
|
1840
|
+
| 40 | 1.06 µs | 1.13 µs | 2.20 µs | 2.8 KiB | 942,385 |
|
|
1841
|
+
| 80 | 1.84 µs | 1.99 µs | 6.68 µs | 5.4 KiB | 543,433 |
|
|
1842
|
+
| 160 | 3.22 µs | 3.39 µs | 9.82 µs | 10.5 KiB | 310,456 |
|
|
1843
|
+
| 320 | 6.01 µs | 6.39 µs | 17.9 µs | 20.8 KiB | 166,327 |
|
|
1844
|
+
| 640 | 11.0 µs | 11.8 µs | 29.2 µs | 41.7 KiB | 91,239 |
|
|
1845
|
+
| 1280 | 22.3 µs | 23.6 µs | 61.0 µs | 82.6 KiB | 44,885 |
|
|
1846
|
+
| 2560 | 45.9 µs | 48.8 µs | 117 µs | 166.5 KiB | 21,776 |
|
|
1847
|
+
| 5120 | 164 µs | 167 µs | 354 µs | 327.1 KiB | 6,092 |
|
|
1848
|
+
| 10240 | 396 µs | 404 µs | 712 µs | 644.3 KiB | 2,524 |
|
|
1849
|
+
|
|
1850
|
+
### `validators.url()`
|
|
1851
|
+
|
|
1852
|
+
**Why we benchmark it.** Checks that an endpoint variable is a well-formed URL. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1853
|
+
|
|
1854
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.url(), and with the size of the values it handles (a large secret, certificate or list). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1855
|
+
|
|
1856
|
+
**Expected growth: O(n).** URL parsing scans the string once, so cost follows its length.
|
|
1857
|
+
|
|
1858
|
+
**Variables that could change its cost**
|
|
1859
|
+
|
|
1860
|
+
| Variable | How it is handled | What it is |
|
|
1861
|
+
| --- | --- | --- |
|
|
1862
|
+
| input size | swept | Length of the URL path, in characters. |
|
|
1863
|
+
| input content | fixed at "an https URL with a long path" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1864
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1865
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1866
|
+
|
|
1867
|
+
**Deliberately not covered**
|
|
1868
|
+
|
|
1869
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1870
|
+
|
|
1871
|
+
**Measured: O(log n)** (exponent 0.62, 10 sizes) -- 🟡 close (neighbouring class).
|
|
1872
|
+
|
|
1873
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1874
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1875
|
+
| 20 | 0.434 µs | 0.482 µs | 0.441 µs | 578 B | 2,306,009 |
|
|
1876
|
+
| 40 | 0.432 µs | 0.472 µs | 0.438 µs | 601 B | 2,316,937 |
|
|
1877
|
+
| 80 | 0.443 µs | 0.490 µs | 0.451 µs | 641 B | 2,259,709 |
|
|
1878
|
+
| 160 | 0.480 µs | 0.519 µs | 0.483 µs | 721 B | 2,085,131 |
|
|
1879
|
+
| 320 | 0.576 µs | 0.620 µs | 0.582 µs | 881 B | 1,737,209 |
|
|
1880
|
+
| 640 | 0.733 µs | 0.808 µs | 0.743 µs | 1.2 KiB | 1,364,213 |
|
|
1881
|
+
| 1280 | 1.01 µs | 1.10 µs | 1.02 µs | 1.8 KiB | 986,851 |
|
|
1882
|
+
| 2560 | 1.51 µs | 1.71 µs | 1.53 µs | 3.1 KiB | 660,770 |
|
|
1883
|
+
| 5120 | 2.53 µs | 3.74 µs | 9.57 µs | 5.6 KiB | 394,662 |
|
|
1884
|
+
| 10240 | 3.91 µs | 4.10 µs | 12.3 µs | 10.9 KiB | 255,726 |
|
|
1885
|
+
|
|
1886
|
+
### `validators.uuid()`
|
|
1887
|
+
|
|
1888
|
+
**Why we benchmark it.** Checks that an identifier variable is a UUID. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1889
|
+
|
|
1890
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.uuid(). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1891
|
+
|
|
1892
|
+
**Expected growth: O(1).** A UUID has a fixed length and a fixed pattern.
|
|
1893
|
+
|
|
1894
|
+
**Variables that could change its cost**
|
|
1895
|
+
|
|
1896
|
+
| Variable | How it is handled | What it is |
|
|
1897
|
+
| --- | --- | --- |
|
|
1898
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one UUID. |
|
|
1899
|
+
| input content | fixed at "a version-4 UUID" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1900
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1901
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1902
|
+
|
|
1903
|
+
**Deliberately not covered**
|
|
1904
|
+
|
|
1905
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1906
|
+
|
|
1907
|
+
**Measured: O(1)** (exponent 0.04, 10 sizes) -- ✅ matches.
|
|
1908
|
+
|
|
1909
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1910
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1911
|
+
| 20 | 0.504 µs | 0.533 µs | 0.600 µs | 605 B | 1,983,602 |
|
|
1912
|
+
| 40 | 0.243 µs | 0.355 µs | 0.248 µs | 585 B | 4,109,888 |
|
|
1913
|
+
| 80 | 0.246 µs | 0.299 µs | 0.251 µs | 585 B | 4,058,767 |
|
|
1914
|
+
| 160 | 0.244 µs | 0.297 µs | 0.250 µs | 585 B | 4,103,190 |
|
|
1915
|
+
| 320 | 0.245 µs | 0.303 µs | 0.248 µs | 585 B | 4,079,402 |
|
|
1916
|
+
| 640 | 0.243 µs | 0.303 µs | 0.248 µs | 585 B | 4,114,760 |
|
|
1917
|
+
| 1280 | 0.245 µs | 0.303 µs | 0.248 µs | 585 B | 4,085,640 |
|
|
1918
|
+
| 2560 | 0.243 µs | 0.318 µs | 0.247 µs | 585 B | 4,112,765 |
|
|
1919
|
+
| 5120 | 0.307 µs | 0.333 µs | 0.325 µs | 588 B | 3,255,157 |
|
|
1920
|
+
| 10240 | 0.247 µs | 0.312 µs | 0.252 µs | 585 B | 4,054,071 |
|
|
1921
|
+
|
|
1922
|
+
### `validators.uuidVersion(v)`
|
|
1923
|
+
|
|
1924
|
+
**Why we benchmark it.** Checks that an identifier is a UUID of a specific version. It runs once for every variable that declares it, at startup, on every process and every deploy, so its per-value cost is multiplied by the number of variables using it.
|
|
1925
|
+
|
|
1926
|
+
**What poor performance would mean.** Startup and cold-start time grow with every variable that uses validators.uuidVersion(v). On serverless platforms that delay is billed on every scale-from-zero event, and a regression here is paid by every service that adopts the helper.
|
|
1927
|
+
|
|
1928
|
+
**Expected growth: O(1).** A UUID has a fixed length and a fixed pattern.
|
|
1929
|
+
|
|
1930
|
+
**Variables that could change its cost**
|
|
1931
|
+
|
|
1932
|
+
| Variable | How it is handled | What it is |
|
|
1933
|
+
| --- | --- | --- |
|
|
1934
|
+
| input size | swept | Varied only to show the helper ignores it; the input is always one UUID. |
|
|
1935
|
+
| input content | fixed at "a version-4 UUID" | A valid value of the expected kind; the failure path (an invalid value) is cheaper because it exits early and is not what startup normally does. |
|
|
1936
|
+
| composition | fixed at "used alone" | Wrapping in `all`, `any`, `optional` or `not` adds a constant per wrapper and is measured in the combinator entries. |
|
|
1937
|
+
| runtime | fixed at "Node (V8)" | Measured on Node only; Bun, Deno and edge runtimes are not covered. |
|
|
1938
|
+
|
|
1939
|
+
**Deliberately not covered**
|
|
1940
|
+
|
|
1941
|
+
- **locale and timezone** -- The helper's cost does not depend on the process locale or timezone for the inputs measured.
|
|
1942
|
+
|
|
1943
|
+
**Measured: O(1)** (exponent -0.00, 10 sizes) -- ✅ matches.
|
|
1944
|
+
|
|
1945
|
+
| variables | Median | p95 | CPU (median) | Heap Δ | Ops/s |
|
|
1946
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1947
|
+
| 20 | 0.243 µs | 0.297 µs | 0.251 µs | 585 B | 4,122,012 |
|
|
1948
|
+
| 40 | 0.247 µs | 0.302 µs | 0.253 µs | 585 B | 4,043,748 |
|
|
1949
|
+
| 80 | 0.246 µs | 0.318 µs | 0.252 µs | 585 B | 4,057,935 |
|
|
1950
|
+
| 160 | 0.248 µs | 0.414 µs | 0.251 µs | 585 B | 4,032,427 |
|
|
1951
|
+
| 320 | 0.243 µs | 0.327 µs | 0.249 µs | 585 B | 4,107,114 |
|
|
1952
|
+
| 640 | 0.243 µs | 0.288 µs | 0.250 µs | 585 B | 4,111,274 |
|
|
1953
|
+
| 1280 | 0.243 µs | 0.281 µs | 0.247 µs | 585 B | 4,107,862 |
|
|
1954
|
+
| 2560 | 0.248 µs | 0.332 µs | 0.257 µs | 586 B | 4,033,650 |
|
|
1955
|
+
| 5120 | 0.244 µs | 0.272 µs | 0.247 µs | 585 B | 4,104,449 |
|
|
1956
|
+
| 10240 | 0.242 µs | 0.298 µs | 0.247 µs | 585 B | 4,137,732 |
|
|
1957
|
+
|
|
1958
|
+
## 3. What makes up one end-to-end operation
|
|
1959
|
+
|
|
1960
|
+
Each function's measured cost is multiplied by how many times one end-to-end operation calls it. A function measured on its own includes everything it calls, so where one attributed function calls another, the nested time is subtracted from the caller (its _exclusive_ time): every moment of the operation belongs to at most one row. Shares are measured against the whole operation with the package, a figure measured directly -- not against the _added_ time, which is the small difference of two noisy medians. They are estimates (each function was measured separately); the remainder is shown as _unattributed_.
|
|
1961
|
+
|
|
1962
|
+
**At 640 variables** (whole operation: 262 µs)
|
|
1963
|
+
|
|
1964
|
+
| Function | Calls / operation | Time if called that often | Exclusive time | Share of operation |
|
|
1965
|
+
| --- | --- | --- | --- | --- |
|
|
1966
|
+
| `validate-env` | 1 | 281 µs | 281 µs | 107% |
|
|
1967
|
+
| _unattributed_ | | | 0 | 0.0% |
|
|
1968
|
+
|
|
1969
|
+
**At 10240 variables** (whole operation: 1.93 ms)
|
|
1970
|
+
|
|
1971
|
+
| Function | Calls / operation | Time if called that often | Exclusive time | Share of operation |
|
|
1972
|
+
| --- | --- | --- | --- | --- |
|
|
1973
|
+
| `validate-env` | 1 | 2.07 ms | 2.07 ms | 107% |
|
|
1974
|
+
| _unattributed_ | | | 0 | 0.0% |
|
|
1975
|
+
|
|
1976
|
+
## Cost model
|
|
1977
|
+
|
|
1978
|
+
Estimates use two bracketing price shapes: **low** = CPU-priced compute ($0.040 per vCPU-hour, billed on CPU time) and **high** = duration-and-memory-priced functions ($0.000017 per GB-second, billed on wall time, at least 128 MB reserved). Both are rounded list prices and change over time; override them in `benchmark.config.json` → `costRates` to match your platform and negotiated pricing.
|
|
1979
|
+
|
|
1980
|
+
## Environment and method
|
|
1981
|
+
|
|
1982
|
+
- Run: `2026-10-02T00:44:24.130Z` → `2026-10-02T00:45:43.444Z` (79 s), ci
|
|
1983
|
+
- Machine: AMD EPYC 9V45 96-Core Processor, 4 logical core(s) (2 physical), 15990 MB RAM, linux/x64, Node v22.23.3, GitHub Actions
|
|
1984
|
+
- Git: `77acd16d0d0b13e9c162061da6d6f7d739436547` on `chore/no-minify-no-dist-urls` (uncommitted changes)
|
|
1985
|
+
- Sizes: 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240 variables -- One environment variable declared in a contract and validated at startup. 640 is a large but realistic service: a few dozen contracts of around ten variables each.
|
|
1986
|
+
|
|
1987
|
+
**Do not compare these numbers with another machine's, another day's, or another package's.** They exist to show how _this_ package's cost changes between runs on comparable hardware and how it scales with size. See [READING-BENCHMARKS.md](../READING-BENCHMARKS.md).
|
|
1988
|
+
|