Skip to content

perf(dom): retire unverified page-map iteration experiment - #798

Closed
seonghobae wants to merge 3 commits into
developfrom
bolt/optimize-dict-loop-9240360491602290334
Closed

seonghobae wants to merge 3 commits into
developfrom
bolt/optimize-dict-loop-9240360491602290334

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

Final disposition

The generated change replaced for key in sorted(mapping) plus a value lookup with sorted(mapping.items()) in two page-building loops and called that a performance improvement. Fresh review found no reproducible benchmark/profile, production workload identity, allocation/heap/GC evidence, runtime/CPU identity, warm-up/repetition policy, or buyer-path p95 evidence. Unit/coverage success is behavioral evidence, not performance evidence, and the tuple-sorting form has its own allocation/indirection trade-off.

The generated repository-wide .jules/bolt.md rule had already been restored to protected-base content. Normal descendant 847ee4fbba0e65b19cde23db8c4903e3ceef446a now also restores src/newsdom_api/dom_builder.py to the exact protected develop@e06b1f3fb10903569124af011da213951e6e2473 blob without rewriting history.

Fresh protected-base → final-head comparison is ahead_by=3, behind_by=0, files=[]; the final tree is exactly the protected-base tree. The experimental commits remain in ancestry, but there is no surviving production, test, fixture, contract, documentation, or performance-evidence delta to integrate.

This therefore qualifies for closure under the no-valid-delta rule. No predecessor GREEN, force-push, destructive rebase, self-approval, bypass, no-op gate result, or unmeasured performance claim is used as acceptance. If page construction later proves to be a material buyer-path hot spot, reopen the problem from measured workload/profile evidence rather than reviving this unverified micro-optimization.

@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cwl-noema-review cwl-noema-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noema LLM review

The PR replaces for page_idx in sorted(dict): ... dict.get(page_idx) patterns with for page_idx, value in sorted(dict.items()) in two places in dom_builder.py, eliminating redundant O(1) hash map lookups. Verified that this preserves exact iteration order (keys are unique, so tuple comparison short-circuits on the key) and yields the identical value objects. The .jules/bolt.md change is purely a learning-log documentation entry. No behavioral, security, or maintainability regressions were introduced.

Reviewed changed lines

  • src/newsdom_api/dom_builder.py:389 (RIGHT): Replaced for page_idx in sorted(page_info_by_idx): page_info = page_info_by_idx.get(page_idx, {}) with for page_idx, page_info in sorted(page_info_by_idx.items()). Since dict keys are unique, tuple comparison compares only the integer keys, preserving the same sort order as sorted(page_info_by_idx). The unpacked page_info is the exact value from the dict, identical to what .get(page_idx, {}) would return (the key always exists).
  • src/newsdom_api/dom_builder.py:429 (RIGHT): Replaced for page_idx in sorted(blocks_by_page_idx): ... blocks_by_page_idx[page_idx] with for page_idx, blocks in sorted(blocks_by_page_idx.items()). The unpacked blocks is the same list object previously retrieved by lookup. The page_info_by_idx.get(page_idx, {}) call and page_number computation remain unchanged, preserving exact behavior.

Adversarial validation

  • src/newsdom_api/dom_builder.py:389 (RIGHT) falsified: sorted(page_info_by_idx.items()) produces the same iteration order and page_info values as sorted(page_info_by_idx) followed by .get(page_idx, {}). — Dict keys are strictly unique integers, so tuple comparison always short-circuits on the first element. For page_info_by_idx = {3: {...}, 1: {}, 2: {...}}, sorted(page_info_by_idx) gives keys [1,2,3]; sorted(page_info_by_idx.items()) compares (1,{}), (2,{...}), (3,{...}) and yields the same key order. Unpacking gives the identical value for each key as the previous .get() because the key exists.
  • src/newsdom_api/dom_builder.py:429 (RIGHT) falsified: Replacing blocks_by_page_idx[page_idx] with the unpacked blocks variable preserves the exact same list object and page_info computation behavior. — For blocks_by_page_idx = {1: [blockA], 2: [blockB]}, sorted(blocks_by_page_idx.items()) yields tuples (1, [blockA]), (2, [blockB]) in the same key order. Unpacking returns the exact list objects bound to each key. No copying, reordering, or mutation occurs. The page_info lookup via .get() and the page_number computation are unchanged.
  • Residual risk: No residual risk identified. The change is a mechanical refactor that eliminates dictionary lookups; iteration order and value references are provably identical. The accompanying documentation change has no runtime effect.

Findings

  • No blocking findings.
  • Result: APPROVE
  • Head SHA: 2c5e9912383c545c72f7d3734db5394b2b55416a
  • Reviewer credential: noema-review-github-app-refresh
  • Actor: cwl-noema-review[bot]

@seonghobae
seonghobae marked this pull request as draft September 4, 2026 08:18
@seonghobae seonghobae changed the title ⚡ Bolt: 딕셔너리 순회 시 중복 조회(Lookup) 제거를 통한 성능 최적화 perf(dom): evaluate page-map iteration shape Sep 4, 2026
@seonghobae seonghobae changed the title perf(dom): evaluate page-map iteration shape perf(dom): retire unverified page-map iteration experiment Sep 4, 2026
@seonghobae seonghobae closed this Sep 4, 2026
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