refactor(html): evaluate table lookup for escape mapping - #631
refactor(html): evaluate table lookup for escape mapping#631seonghobae wants to merge 8 commits into
Conversation
|
👋 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 |
Current exact authority
master@728f0f33323e43573d6664209891099502827d5d3c10a822934a9d697770d3b76fd2303114a2f8a8mastersrc/main/kotlin/html4tree/main.ktplussrc/test/kotlin/html4tree/EscapeHtmlLookupContractTest.kt.jules/bolt.mdis restored byte-for-byte to protected authority; the one-sided benchmark was removedReview finding → repair
The original branch claimed that Kotlin's
when (Char)implementation necessarily performs O(N) comparisons and that anArray<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 addedBenchmark.kttimed only the candidateescapeHtml()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
45c880bf078083fbf0a907eb16a33ead0e89d6aepreserved the intervening production source while restoring the repository-wide Bolt document to protected authority and deleting that non-comparative benchmark. Successor3c10a822934a9d697770d3b76fd2303114a2f8a8adds 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
StringBuilderbehavior 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
3c10a822934a9d697770d3b76fd2303114a2f8a8are non-terminal: CI33992161014, SAST Semgrep33992160966, CodeQL PR33992160940, and Security Scan33992160983are 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.