Repository navigation
perf(search): evaluate in-place intersection and explicit score loop - #610
seonghobae wants to merge 5 commits into
Conversation
- 다중 검색어 교집합 연산 시 매 반복마다 발생하는 set 재할당 오버헤드를 줄이기 위해 & 연산자 대신 intersection_update 사용 - 반복문 내의 sum() 및 제너레이터 인스턴스화 비용을 회피하기 위해 점수(score) 합산 로직을 inline for 루프로 전개 (언롤링)
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- 다중 검색어 교집합 연산 시 매 반복마다 발생하는 set 재할당 오버헤드를 줄이기 위해 & 연산자 대신 intersection_update 사용 - 반복문 내의 sum() 및 제너레이터 인스턴스화 비용을 회피하기 위해 점수(score) 합산 로직을 inline for 루프로 전개 (언롤링)
- 다중 검색어 교집합 연산 시 매 반복마다 발생하는 set 재할당 오버헤드를 줄이기 위해 & 연산자 대신 intersection_update 사용 - 반복문 내의 sum() 및 제너레이터 인스턴스화 비용을 회피하기 위해 점수(score) 합산 로직을 inline for 루프로 전개 (언롤링)
- 다중 검색어 교집합 연산 시 매 반복마다 발생하는 set 재할당 오버헤드를 줄이기 위해 & 연산자 대신 intersection_update 사용 - 반복문 내의 sum() 및 제너레이터 인스턴스화 비용을 회피하기 위해 점수(score) 합산 로직을 inline for 루프로 전개 (언롤링)
Current authority
main@47c6fd27de13b0da37a7db64697b869941909351572f8e8b9aa8f73184f9ab73d92472730fdac7f3transcript_search.pyonly (+10/-4)Scope correction
The generated candidate contains two independent Python micro-optimizations:
set(postings)working copy, then useintersection_update(postings)instead of allocating a new set on each later term;sum(entry.counts[term] for term in unique_terms)with an explicit accumulator loop using one localcountsbinding.The generated
.jules/bolt.mdasserted both choices as universally faster and quoted an expected ~30% improvement without repository-current representative evidence. That retrospective doctrine has been removed ordinary-forward by restoring the protected blob byte-for-byte; the generated commits remain in ancestry.This PR is an alternative candidate to #622, not proven superior to it. #622 currently evaluates the same in-place intersection plus a list-comprehension score reduction; this head instead uses an explicit accumulator loop and avoids that list allocation. Choose between the score implementations only from enclosing
TranscriptIndex.search()measurements, not intuition or isolated-expression timing.Required semantic RED/GREEN
Before performance promotion, add executable equivalence against protected behavior covering empty/missing postings, one-term and repeated-term queries, early/late empty intersections, score/tie ordering, skewed/large postings, Unicode/CJK, and explicit proof that
self._postingsis never mutated. The resultingMatchvalues and ordering must be identical.Performance acceptance
Measure the actual search path on the same runtime/host with a documented right-cleared workload shape (entries, postings cardinality/skew, terms, match count), warm-up/repetition policy, wall/CPU median+p95, allocation and peak-memory evidence. Separate the intersection and score-loop effects through ablation. Do not claim ~30% or buyer-visible benefit unless the enclosing path demonstrates it beyond noise.
The new exact head has no PR workflow runs visible yet; predecessor results do not transfer. Keep Draft until one unchanged exact head has semantic equivalence, measured evidence appropriate to the claim, terminal required gates, and qualifying independent review.
No force push, destructive rebase, self-approval, source-neutral rerun, scanner suppression, gate weakening, or predecessor-GREEN transfer.