GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/packages/opencode/script/bench-search.ts at dev · arh/opencode Expand file tree/ Copy pathbench-search.tsMore file actions 94 lines (75 loc) · 3.51 KB / Copy pathbench-search.tsFile metadata and controls94 lines (75 loc) · 3.51 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 import { Effect } from "effect" import { Fff } from "@opencode-ai/core/filesystem/fff.bun" import { AppRuntime } from "@/effect/app-runtime" import { FileSystem } from "@opencode-ai/core/filesystem" import { AbsolutePath } from "@opencode-ai/core/schema" import { InstanceStore } from "@/project/instance-store" const dir = AbsolutePath.make(process.cwd()) const FILE_QUERIES = ["fff", "package.json", "tools/ experiment"] const GREP_QUERIES = ["FileFinder", "import", "grep", "autocomplete"] const GLOB_QUERIES = ["**/*.test.ts"] const FILE_LIMIT = 100 const GREP_LIMIT = 50 const GLOB_LIMIT = 50 const run = <A, R>(effect: Effect.Effect<A, unknown, R>) => AppRuntime.runPromise( InstanceStore.Service.use((store) => store.provide({ directory: dir }, effect as never)), ) as Promise<A> // --- raw Fff picker --- const t0 = performance.now() const made = Fff.create({ basePath: dir, aiMode: true }) if (!made.ok) { console.error("Fff.create failed:", made.error) process.exit(1) } const picker = made.value console.log(`picker create: ${(performance.now() - t0).toFixed(1)}ms`) const tw = performance.now() await picker.waitForScan(2_500) console.log(`wait for scan: ${(performance.now() - tw).toFixed(1)}ms`) // warmup grep to let the content index build const tWarmup = performance.now() picker.grep("_warmup_", { mode: "regex", maxMatchesPerFile: 1, timeBudgetMs: 1_500 }) console.log(`grep warmup: ${(performance.now() - tWarmup).toFixed(1)}ms`) console.log() console.log("--- raw picker (warm) ---") for (const q of FILE_QUERIES) { const t = performance.now() const r = picker.fileSearch(q, { pageSize: Math.max(FILE_LIMIT, 100) }) const count = r.ok ? r.value.items.length : "err" console.log(`[picker] fileSearch "${q}": ${(performance.now() - t).toFixed(1)}ms (${count} results)`) } for (const q of GREP_QUERIES) { const t = performance.now() const r = picker.grep(q, { mode: "regex", pageSize: GREP_LIMIT, timeBudgetMs: 1_500 }) const count = r.ok ? r.value.items.length : "err" console.log(`[picker] grep "${q}": ${(performance.now() - t).toFixed(1)}ms (${count} matches)`) } picker.destroy() // --- Search service: init breakdown --- console.log() // 1) runtime + InstanceState + picker create + scan poll const tRuntime = performance.now() console.log(`[Search] init file (runtime + picker + scan): ${(performance.now() - tRuntime).toFixed(1)}ms`) // 2) grep warmup (content index cold-start inside the Search service picker) const tGrepWarmup = performance.now() await run(FileSystem.Service.use((svc) => svc.grep({ pattern: "_warmup_grep_", limit: 1 }))) console.log(`[Search] init grep (content index warmup): ${(performance.now() - tGrepWarmup).toFixed(1)}ms`) console.log() console.log("--- Search service (warm) ---") for (const q of FILE_QUERIES) { const t = performance.now() const r = await run(FileSystem.Service.use((svc) => svc.find({ query: q, limit: FILE_LIMIT }))) console.log(`[Search.find] "${q}": ${(performance.now() - t).toFixed(1)}ms (${r.length} results)`) } for (const q of GREP_QUERIES) { const t = performance.now() const r = await run(FileSystem.Service.use((svc) => svc.grep({ pattern: q, limit: GREP_LIMIT }))) console.log(`[Search.grep] "${q}": ${(performance.now() - t).toFixed(1)}ms (${r.length} matches)`) } for (const q of GLOB_QUERIES) { const t = performance.now() const r = await run(FileSystem.Service.use((svc) => svc.glob({ pattern: q, limit: GLOB_LIMIT }))) console.log(`[Search.glob] "${q}": ${(performance.now() - t).toFixed(1)}ms (${r.length} files)`) } process.exit(0) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |