Repository navigation
perf(core): 옵시디언 위키링크를 찾을 때 같은 줄을 다시 훑지 않는다 - #125
Merged
Merged
Conversation
옵시디언 채널은 `[[` 를 만날 때마다 같은 줄에서 `]]` 를 찾는다. 닫히지 않으면 줄 끝까지 훑은 결과를 버리고 다음 `[[` 에서 다시 훑어서, `[` 만 있는 줄이나 안 닫힌 `[[` 가 이어진 줄이 O(n²) 이었다. release CLI 로 `[` 8만 자 한 줄이 1,650ms(Go 2,304ms)였고, 같은 입력의 github-markdown 은 5ms 안팎이다. #111 이 링크 쪽에서 막은 입력과 같은 모양인데, 그 시험과 벤치가 html 채널만 돌았다. 훑다 멈춘 자리를 돌려받아 기억하고, 그 앞에서 시작하는 `[[` 는 다시 훑지 않는다. 그 `[[` 도 같은 꼬리를 보니 닫히지 않는다. 줄바꿈(되돌린 코드 스팬을 다시 읽을 때)과 빈 `[[]]` 에서는 그 자리까지만 건너뛴다. 출력은 그대로다. - Rust `wikilink_len` · Go `wikilinkLen` 이 멈춘 자리를 돌려준다 - 시험: `long_unclosed_wikilinks_preserve_text` · `TestLongUnclosedWikilinksPreserveText` - 벤치: Go `BenchmarkUnclosedWikilinks` - 할당 게이트: `obsidian_prose_streaming_is_allocation_free_once_warm` · Go 같은 이름 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0183TGUjmyUtZXhyCSeRS3qj
minjun0219
marked this pull request as ready for review
October 17, 2026 11:31
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by 민준 · project thread
Before:
obsidian-markdown채널이 닫히지 않은[[가 많은 줄에서 O(n²) 으로 느려졌다.[만 있는 한 줄을 release CLI 로 돌리면 1만 자 28ms, 2만 자 102ms, 4만 자 389ms, 8만 자 1,650ms 였고(Go CLI 는 8만 자 2,304ms), 같은 입력의github-markdown은 5ms 안팎이었다. 안 닫힌 위키링크가 이어진[[a× 2만(8만 자)도 357ms 였고,--stream도 같았다([4만 자 394ms). #121 에서 들어와 release PR #124 에 들어 있다.After: 같은 입력이 다른 채널처럼 선형으로 돈다.
[8만 자가 8ms(Go 14ms),[[a× 2만이 9ms(--stream7ms)다. 출력은 바뀌지 않는다.How:
[[마다wikilink_len(GowikilinkLen)이 같은 줄의]]를 찾는데, 못 찾으면 줄 끝까지 훑은 결과를 버리고 다음[[에서 다시 훑었다. 이제 훑다 멈춘 자리(줄바꿈 · 줄 끝 · 빈[[]]의]])를 돌려받아render안에서 기억하고, 그 앞에서 시작하는[[는 다시 훑지 않는다. 그[[가 볼 꼬리는 이미 본 꼬리의 일부라 역시 닫히지 않는다. 줄바꿈은 되돌린 코드 스팬을 다시 읽을 때만render에 들어오는데, 줄바꿈 뒤의[[는 다시 찾는다. #111 이 링크 쪽에서 막은 것과 같은 모양의 입력인데, 그 시험(long_unclosed_brackets_preserve_text)과 벤치(BenchmarkUnclosedBrackets)가html채널만 돌아서 드러나지 않았다.long_unclosed_wikilinks_preserve_text, GoTestLongUnclosedWikilinksPreserveText.[10만 자와[[a× 2.5만을 완성본과 스트리밍으로 돌리고, 줄바꿈 뒤와 빈[[]]뒤에서는 다시 찾는 것을 본다. 고치기 전 코어로는 이 시험이 release 빌드에서 10.7초, 고친 뒤 0.02초다.BenchmarkUnclosedWikilinks. 1만 · 2만 · 4만 자가 고치기 전 102 · 409 · 1,586 ms/op, 고친 뒤 0.56 · 1.04 · 2.14 ms/op 로BenchmarkUnclosedBrackets와 같은 수준이다.obsidian_prose_streaming_is_allocation_free_once_warm, GoTestObsidianProseStreamingIsAllocationFreeOnceWarm. 위키링크 · 첨부([[…]]) · 안 닫힌[[를 흘린다. 위키링크 경로에 할당을 일부러 넣으면 Rust 게이트가 실패하는 것(84회)을 확인했다.코퍼스에는 넣지 않았다. 출력이 바뀌지 않는 성능 회귀라 실제로 겪은 고장 케이스가 아니고, #111 처럼 단위 시험과 벤치로 고정했다. 고치기 전후 Rust CLI 를 대괄호 · 백틱 · 줄바꿈 · 물결표가 섞인 무작위 입력 3,000개(완성본과
--stream)에 돌려 출력이 모두 같은 것도 확인했다.검증(로컬):
./scripts/readme-sync.sh,cargo test --workspace --locked,cargo clippy --workspace --all-targets --locked -- -D warnings,cargo build -p mdwire-wasm --target wasm32-unknown-unknown --locked,gofmt·go vet·MDWIRE_RUST=../target/debug/mdwire go test ./...(TestParityWithRustCore포함),./scripts/build-npm.sh && CI=1 ./scripts/smoke.sh(Node · Bun · lezer · Workers · TypeScript),examples/react-streaming빌드.context7.json스키마 단계는 이 환경에서 context7.com 에 닿지 않아 돌리지 못했다(파일은 바꾸지 않았다). 사이트는 바꾸지 않았다.Generated by Claude Code