Skip to content

refactor(html): evaluate table lookup for escape mapping - #631

Draft
seonghobae wants to merge 8 commits into
masterfrom
bolt/optimize-html-escape-17046559660206527849
Draft

refactor(html): evaluate table lookup for escape mapping#631
seonghobae wants to merge 8 commits into
masterfrom
bolt/optimize-html-escape-17046559660206527849

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Current exact authority

  • protected base: master@728f0f33323e43573d6664209891099502827d5d
  • exact head: 3c10a822934a9d697770d3b76fd2303114a2f8a8
  • ancestry: ahead 3 / behind 0; merge base is exact protected master
  • effective protected-base delta: src/main/kotlin/html4tree/main.kt plus src/test/kotlin/html4tree/EscapeHtmlLookupContractTest.kt
  • .jules/bolt.md is restored byte-for-byte to protected authority; the one-sided benchmark was removed
  • lifecycle: Draft; performance/current-head hosted evidence remains incomplete

Review finding → repair

The original branch claimed that Kotlin's when (Char) implementation necessarily performs O(N) comparisons and that an Array<String?> lookup therefore changes the escape mapping to O(1), with rendering and GC gains. Repository evidence did not establish that JVM/Kotlin implementation claim. The added Benchmark.kt timed only the candidate escapeHtml() implementation, had no protected-base comparator or result distribution, and did not exercise the buyer generation path, so it could not demonstrate or causally attribute an improvement.

Normal descendant 45c880bf078083fbf0a907eb16a33ead0e89d6ae preserved the intervening production source while restoring the repository-wide Bolt document to protected authority and deleting that non-comparative benchmark. Successor 3c10a822934a9d697770d3b76fd2303114a2f8a8 adds deterministic semantic characterization: empty/plain ASCII remain unchanged; all six protected escape mappings remain byte-identical; CJK/Arabic/Hebrew pass through unchanged; and mixed Unicode plus escaped ASCII retains exact output. No force-push, destructive rebase, no-op retrigger, or generated-doctrine promotion was used.

Current source contract

The candidate maps the same six escaped ASCII characters through a 128-entry table and preserves the existing lazy StringBuilder behavior and non-ASCII path. That contract is now directly characterized, but the representation is still only a candidate refactor, not a proven performance optimization.

If performance remains the merge rationale, compare protected and candidate implementations under the same JVM/Kotlin/runtime using representative/right-cleared directory-name/content strings and the actual generation path. Record warm-up, workload/cardinality, repeated distribution including tail latency, allocation/GC/profile observations, and buyer-path effect. A one-sided loop or unit coverage is not performance evidence. If controlled evidence does not show a material benefit while preserving exact output, restore the simpler protected representation.

Exact-head evidence

Fresh workflows on 3c10a822934a9d697770d3b76fd2303114a2f8a8 are non-terminal: CI 33992161014, SAST Semgrep 33992160966, CodeQL PR 33992160940, and Security Scan 33992160983 are queued. Predecessor results do not transfer.

Keep Draft until one unchanged exact head has terminal required/security/SAST/CodeQL evidence, qualifying current review, and—if performance is used to justify added representation complexity—controlled comparative performance evidence. No self-approval, bypass, gate weakening, force update, destructive rebase, generated doctrine, or benchmark overclaim.

@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 5, 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.

@seonghobae seonghobae changed the title ⚡ Bolt: [성능 개선] HTML 이스케이프 로직 배열 조회 기반으로 최적화 refactor(html): evaluate table lookup for escape mapping Sep 5, 2026
@seonghobae
seonghobae marked this pull request as draft September 5, 2026 21:05
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