Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a repeatable, network-free initialization performance test/benchmark. This is a separate PR stacked on #498 (
flags-version-header) for the version-header client mode. It now includes the opt-in generated JSON-parse probe plus the benchmark, tests, and docs: the base branch no longer contains the earlier parse-probe commit. No further changes were pushed to #498 by this benchmark task. Retarget after that dependency lands.VERCEL_FLAGS_DEBUG_EMBEDDED_PARSE=1timer, disabled by default, which logs only parse duration and input length.Usage
Add
--jsonfor unrounded phase median/p95 values and validation counters.Local measurements
Node 22.22.3 on Apple M5 Pro, supplied 31-flag fixture (8,394 bytes after synthetic metadata normalization), 20 fresh-process samples per scenario / 160 processes total. Times below are median
initialize()durations, excluding client creation.For the fresh-header case, SDK-key hash lookup accounts for about 0.897 ms, or OIDC auth lookup about 1.207 ms. Embedded import is around 0.27 ms and JSON parsing around 0.039 ms. Same-client reinitialization is around 0.001 ms.
These are instrumented local diagnostic measurements, not deployed latency predictions: stream transport is mocked; fixture/mock construction and initial SDK module loading are outside the interval; Next.js
use cacheand live network latency are not measured. Some phase measurements are inclusive parents/children, documented in the README. Independently computed phase medians need not sum to the total median.Verification
All completed with exit code 0:
pnpm --filter @vercel/flags-core exec vitest run bench/init.test.ts src/vercel-mode.black-box.test.ts src/controller/header-source.test.ts src/utils/read-bundled-definitions.test.ts— 72 tests passed.pnpm --filter @vercel/flags-core type-check— passed.pnpm --filter @vercel/prepare-flags-definitions exec vitest run src/index.test.ts— 30 tests passed (102 focused tests total).pnpm --filter @vercel/prepare-flags-definitions type-check— passed.pnpm exec biome check packages/prepare-flags-definitions/src/index.ts packages/prepare-flags-definitions/src/index.test.ts packages/vercel-flags-core/bench packages/vercel-flags-core/package.json packages/vercel-flags-core/tsconfig.json— passed.git diff --check— passed.pnpm --filter @vercel/flags-core bench:init --definitions /path/to/datafile.json --samples 20— all eight scenarios, cold/warm paths, and per-sample assertions passed against the supplied local file.