MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / quantile

Function quantile

packages/server/test/snapshot.perf.test.ts:66–70  ·  view source on GitHub ↗
(samples: readonly number[], q: number)

Source from the content-addressed store, hash-verified

64}
65
66function quantile(samples: readonly number[], q: number): number {
67 const sorted = [...samples].sort((a, b) => a - b);
68 const idx = Math.min(sorted.length - 1, Math.floor(q * sorted.length));
69 return sorted[idx]!;
70}
71
72describe('SnapshotReader perf (real HTTP, 50 sessions)', () => {
73 it(`mode=${process.env['KIMI_SNAPSHOT_READER'] ?? 'auto'} p95 stays under 200ms warm`, async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected