Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@
## 2025-02-12 - [Fast Path Execution in Directory Traversal and Log Parsing]
**Learning:** Checking for string existence (`if "silence_" not in stderr`) before invoking regex matchers provides significant speed improvements when parsing large blocks of text. Similarly, moving expensive I/O operations like `os.path.realpath` inside conditional blocks prevents redundant disk access when configuration (like path exclusions) isn't utilized.
**Action:** When working on large text processing or disk operations, verify if early exit conditions or conditional execution can bypass the expensive system or library calls.
## 2024-08-16 - [불필요한 방어적 복사 제거]
**학습:** [루프 내에서 비트 연산자(&)를 사용하여 집합 교집합을 수행할 때, 초기 집합의 방어적 복사본(예: set(postings))을 만들지 않아도 됩니다. & 연산자는 본질적으로 새로운 집합을 반환하므로, 초기 O(N) 복사는 중복되며 성능 병목 현상을 일으킵니다.]
**실행:** [반복문에서 집합 교집합을 처리할 때 불필요한 set() 변환을 피하고 바로 할당하여 사용합니다.]
7 changes: 4 additions & 3 deletions transcript_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,13 @@ def add(self, recording_id: str, segments: Iterable[Any]) -> int:
"""
added = 0
for segment in segments:
text = str(_read_attr(segment, "text"))
entry = _Entry(
recording_id=recording_id,
start=float(_read_attr(segment, "start")),
end=float(_read_attr(segment, "end")),
text=str(_read_attr(segment, "text")),
counts=Counter(tokenize(str(_read_attr(segment, "text")))),
text=text,
counts=Counter(tokenize(text)),
)
position = len(self._entries)
self._entries.append(entry)
Expand Down Expand Up @@ -242,7 +243,7 @@ def search(self, query: str) -> list[Match]:
if not postings:
return []
candidates = (
set(postings) if candidates is None else candidates & postings
postings if candidates is None else candidates & postings
)
if not candidates:
return []
Expand Down
Loading