perf: audit EmbeddingGemma 2 and reuse measured query embeddings
Core CI / core (ubuntu-latest) (push) Failing after 3m43s
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Successful in 5m56s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
Core CI / core (ubuntu-latest) (push) Failing after 3m43s
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Successful in 5m56s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
This commit is contained in:
1 parent
9870df7cb5
commit
8b9b079469
21 files changed
+4119
-129
No files matched your search
@@ -11,6 +11,8 @@ import {
|
||||
AutomaticIndexGate,
|
||||
emptySearchState,
|
||||
LatestLane,
|
||||
semanticAvailable,
|
||||
SEMANTIC_SETTLE_MS,
|
||||
} from "./search-state";
|
||||
import type { SemanticPhase } from "./search-state";
|
||||
import { fileIcon, icon } from "./icons";
|
||||
@@ -272,12 +274,7 @@ function refreshEmptySearchState() {
|
||||
}
|
||||
|
||||
function canSearchSemantically() {
|
||||
return Boolean(
|
||||
semanticStatus?.ready &&
|
||||
semanticStatus.generation !== null &&
|
||||
!semanticStatus.embedding &&
|
||||
!semanticJobActive,
|
||||
);
|
||||
return semanticAvailable(semanticStatus);
|
||||
}
|
||||
|
||||
function queueSemanticRefresh(delay = 1000) {
|
||||
@@ -954,7 +951,7 @@ function refreshPerformance(request: SearchRequest) {
|
||||
);
|
||||
for (const [lane, delay] of Object.entries(report.lane_schedule_ms))
|
||||
append(
|
||||
`${lane}: scheduled ${delay.toFixed(1)} ms after debounce${lane === "hybrid" ? " (includes intentional 350 ms semantic delay or waiting for readiness)" : ""}`,
|
||||
`${lane}: scheduled ${delay.toFixed(1)} ms after debounce${lane === "hybrid" ? ` (includes intentional ${SEMANTIC_SETTLE_MS} ms semantic delay or waiting for readiness)` : ""}`,
|
||||
);
|
||||
for (const attempt of report.attempts) {
|
||||
append(
|
||||
@@ -1123,7 +1120,7 @@ async function search(inputAt = performance.now()) {
|
||||
hybridTimer = setTimeout(() => {
|
||||
if (isCurrent(request) && canSearchSemantically())
|
||||
submitSearch(request, "hybrid");
|
||||
}, 350);
|
||||
}, SEMANTIC_SETTLE_MS);
|
||||
} catch (error) {
|
||||
showError(error);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
/** Let rapid typing settle before starting the model lane. */
|
||||
export const SEMANTIC_SETTLE_MS = 120;
|
||||
|
||||
/** A rebuild retains the previous committed generation. Backend readiness is
|
||||
* withdrawn only while a replacement query graph is being prepared. */
|
||||
export function semanticAvailable(
|
||||
status: { ready: boolean; generation: number | null } | null,
|
||||
) {
|
||||
return Boolean(status?.ready && status.generation !== null);
|
||||
}
|
||||
|
||||
/** One active request per lane; intermediate keystrokes collapse to the latest.
|
||||
* Native work already running cannot be cancelled, so revisions guard every
|
||||
* result and retry. Busy responses receive at most one delayed retry. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { LatestLane, AutomaticIndexGate, emptySearchState } from '../src/search-state.ts';
|
||||
import { LatestLane, AutomaticIndexGate, emptySearchState, semanticAvailable, SEMANTIC_SETTLE_MS } from '../src/search-state.ts';
|
||||
const settle = () => new Promise(resolve => setImmediate(resolve));
|
||||
|
||||
test('coalesces queued keystrokes and discards stale responses', async () => {
|
||||
@@ -67,3 +67,14 @@ test('no document content and unavailable semantics have actionable distinct gui
|
||||
assert.match(emptySearchState('lexical', 'no-content').detail, /readable documents/);
|
||||
assert.match(emptySearchState('lexical', 'unavailable').detail, /retry the search/);
|
||||
});
|
||||
|
||||
|
||||
test('old committed semantic generation stays available during rebuild, activation readiness gates replacement', () => {
|
||||
assert.equal(semanticAvailable(null), false);
|
||||
assert.equal(semanticAvailable({ready: true, generation: null, embedding: true}), false);
|
||||
assert.equal(semanticAvailable({ready: true, generation: 1, embedding: false}), true);
|
||||
assert.equal(semanticAvailable({ready: true, generation: 1, embedding: true}), true);
|
||||
assert.equal(semanticAvailable({ready: false, generation: 2, embedding: true}), false);
|
||||
assert.equal(semanticAvailable({ready: true, generation: 2, embedding: false}), true);
|
||||
assert.equal(SEMANTIC_SETTLE_MS, 120);
|
||||
});
|
||||
Reference in new issue
Block a user