惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
T
Threatpost
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
S
Securelist
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
S
Secure Thoughts
MyScale Blog
MyScale Blog
O
OpenAI News
P
Palo Alto Networks Blog
美团技术团队
C
Cyber Attacks, Cyber Crime and Cyber Security
TaoSecurity Blog
TaoSecurity Blog
量子位
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
Know Your Adversary
Know Your Adversary
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Simon Willison's Weblog
Simon Willison's Weblog
宝玉的分享
宝玉的分享
PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
I
InfoQ
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
S
Security @ Cisco Blogs
S
Schneier on Security
B
Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Cloudflare Blog
AWS News Blog
AWS News Blog
IT之家
IT之家
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
H
Heimdal Security Blog
I
Intezer
A
Arctic Wolf
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Help Net Security
W
WeLiveSecurity

Flags SDK Documentation

Evaluation Context Precompute GrowthBook Hypertune PostHog Split Evaluation Context Quickstart Precompute Evaluation Context Quickstart Precompute GrowthBook Hypertune PostHog Split Proxy Dashboard Pages Marketing Pages Dashboard Pages Marketing Pages Data Locality Providers LaunchDarkly Optimizely Reflag Statsig Server-side vs Client-side Flags as Code Custom Adapters Edge Config Flagsmith Vercel flags flags/react flags/next flags/sveltekit Dedupe AB Tasty CloudBees Confidence by Spotify ConfigCat DevCycle FeatBit flagd Flipt GO FeatureFlag OpenFeature Kameloon Tggl Suspense Fallbacks
Bulk Evaluation
Vercel · 2026-06-26 · via Flags SDK Documentation

Evaluate multiple feature flags at once with evaluate().

evaluate (from flags/next) resolves multiple feature flags in a single call. Use it instead of awaiting flags one at a time or resolving them with Promise.all, both of which add avoidable latency or overhead. To evaluate a single flag, keep calling it directly with await myFlag().

Awaiting each flag in turn blocks on every flag before starting the next one, so the flags resolve sequentially. Total latency becomes the sum of every flag's evaluation time instead of the slowest single flag.

import { flagA, flagB } from './flags';

// avoid: each await blocks the next, so the flags resolve sequentially
const a = await flagA();
const b = await flagB();

Promise.all removes the sequential wait by starting every flag at once, but it evaluates each flag in isolation.

import { flagA, flagB } from './flags';

// avoid: resolves in parallel, but can't share work across the flags
const [a, b] = await Promise.all([flagA(), flagB()]);

Because each flag runs on its own, Promise.all can't reuse work across the batch. Every flag reads headers, cookies, and overrides again, and adapters can't resolve a group of flags through a single call. It also creates one promise per flag, with each flag spawning further internal promises as it evaluates, which adds microtask queue overhead and leaves more room for the work to be interrupted by other microtasks.

evaluate resolves a set of flags in a single call. It pre-reads headers, cookies, and overrides once for the whole batch and lets adapters resolve a group through one call, so it shares work across evaluations and reduces the number of parallel promises the runtime has to manage.

import { evaluate } from 'flags/next';
import { flagA, flagB } from './flags';

// prefer: shares work across the batch
const [a, b] = await evaluate([flagA, flagB]);

evaluate accepts either an array of flags, returning positional results, or an object whose values are flags, returning keyed results.

// array form — positional results
const [a, b] = await evaluate([flagA, flagB]);

// object form — keyed results
const { a, b } = await evaluate({ a: flagA, b: flagB });

Outside the App Router, in Pages Router (getServerSideProps, API routes) or in routing middleware, pass the request as the second argument so evaluate can read headers and cookies:

const [a, b] = await evaluate([flagA, flagB], request);

Evaluation context

evaluate accepts only flags and an optional request. It does not take an evaluation context or entities argument. Each flag resolves its own evaluation context from the identify function declared on the flag, and evaluate calls that identify for you, sharing the result across the batch.

To control the context for a flag evaluated through evaluate, set it in that flag's identify function, which can read the request's headers and cookies and return whatever entities you need. Passing entities directly is only supported when calling a single flag with await myFlag.run({ identify: entities }), which bypasses identify and uses the entities you provide.

evaluate always evaluates flags dynamically at request time. It calls each flag's adapter (or decide), just as calling the flag directly does.

It is not the way to read the values of precomputed flags. When flags were precomputed in the proxy and encoded into a code, read their values without re-evaluating using getPrecomputed (or by calling the flag with the code, await myFlag(code, flagGroup)).

Aside from the Flags SDK itself getting faster, adapters can implement the optional bulkDecide hook. When an adapter implements it, evaluate calls bulkDecide once per group of flags that share an adapter and identify source, instead of calling decide per flag, so the underlying provider can share work across evaluations too.

The Vercel adapter (@flags-sdk/vercel) implements bulkDecide, with roughly a 10x reduction in evaluation time when resolving hundreds of flags in parallel.

Implement bulkDecide in a custom adapter