Skip to content

feat(profiling): P3 per-segment query profiler timing + scenarios (LOC-68)#72

Merged
dev07060 merged 2 commits into
mainfrom
feat/loc-68-profiler-timing
Jun 1, 2026
Merged

feat(profiling): P3 per-segment query profiler timing + scenarios (LOC-68)#72
dev07060 merged 2 commits into
mainfrom
feat/loc-68-profiler-timing

Conversation

@dev07060

@dev07060 dev07060 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

P3 — 세그먼트 타이밍 + 3시나리오 × 2레인 (LOC-68)

온디바이스 RAG 쿼리 단계(embed / activate / search / hydrate)를 격리 계측하는 프로파일러 본체. DESIGN Approach C, Phase-1(Rust 0변경).

변경

  • example/lib/profiling/query_profiler.dartSourceRagService.searchMeta 경로 미러 + 단계별 Stopwatch. 엔진 private 헬퍼 복제(_indexPath FNV-1a, _toInt64List FRB Int64List), activateOnly/deleteOnDiskIndex로 결정적 cold 셋업, hit sourceId 반환.
  • example/integration_test/query_profile_measure_test.dart — pure_cold / pure_warm(2레인) / switching_cold(A→B→A). 단독 파일, init 전 DB 삭제(clearAllData 비동기 재초기화-seed 경합 → database is locked 회피), 15m timeout, 행단위 PROFILE_CSV 로그.
  • example/test_driver/integration_test.dart + flutter_rust_bridge ^2.11.1 dep.

측정 방법 (중요: flutter test 아님 → flutter drive)

flutter test는 빌드를 debug로 하드핀 → cargokit debug → fallback 백엔드(출시 vector_faer,vector_quant_i8 미적용)라 측정 무효.

cd example && flutter drive --driver=test_driver/integration_test.dart \
  --target=integration_test/query_profile_measure_test.dart --profile -d <device-id>

fail-closed: kDebugMode skip+assert / 필터레인 hit sourceId ⊆ 요청 / 세그먼트별 N>0.

실기 결과 (iPhone iOS 26.5, profile, 500 docs/collection, topK=10)

lane category embed p50/p95 activate search p50/p95 hydrate p50/p95
unfiltered pure_cold (n=1) 25.2 247.3 2.20 0.42
unfiltered pure_warm (n=30) 26.7 / 36.7 1.60 / 2.08 0.27 / 0.41
filtered(i8) pure_warm (n=30) 27.6 / 37.6 0.76 / 0.92 0.19 / 0.30
unfiltered switching_cold (n=30) 25.7 / 37.0 (로그 트렁케이션 유실) 1.47 / 1.90 (유실)

warm은 embed(ONNX) 지배(~27ms, 15–37배), cold는 activate(247ms) 지배. 상세 디바이스/방법/디버그 로그·결론: PR-P3.md · Linear LOC-68.

검증

flutter analyze 클린. iPhone profile 런 green. cargo 영향 없음(Dart/example 전용). 머지는 본인.

dev07060 added 2 commits June 1, 2026 13:07
… (LOC-68)

Per-segment timing driver (embed/activate/search/hydrate) mirroring
SourceRagService.searchMeta, replicating the private _indexPath (FNV-1a) and
_toInt64List (FRB Int64List) helpers, with activateOnly/deleteOnDiskIndex for
deterministic cold setup and hit sourceIds for fail-closed filter checks.

Profile-mode requires flutter drive (flutter test hard-pins debug = fallback
backend), so adds test_driver/integration_test.dart and the flutter_rust_bridge
dep the profiler needs for FRB i64 lists.
…(LOC-68)

Measurement entrypoint (own file, runs under flutter drive --profile): pure_cold
/ pure_warm (both lanes) / switching_cold, fresh DB via pre-init file delete (no
clearAllData race), 15m timeout, per-row CSV log. Fail-closed: kDebugMode
skip+assert, hits>0, filtered hits' sourceId in requested set. PR-P3.md + README.
@linear-code

linear-code Bot commented Jun 1, 2026

Copy link
Copy Markdown

LOC-68

@dev07060 dev07060 self-assigned this Jun 1, 2026
@dev07060 dev07060 merged commit feed666 into main Jun 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant