Bug 241252 - Optimize HTMLTokenizer::bufferASCIICharacter()
Summary: Optimize HTMLTokenizer::bufferASCIICharacter()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-06-02 20:08 PDT by Chris Dumez
Modified: 2022-06-03 07:38 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2022-06-02 20:08:12 PDT
Optimize HTMLTokenizer::bufferASCIICharacter() by appending several characters at once whenever possible.
Comment 1 Chris Dumez 2022-06-02 20:17:41 PDT
Pull request: https://github.com/WebKit/WebKit/pull/1265
Comment 2 EWS 2022-06-02 22:42:38 PDT
Committed r295171 (251255@main): <https://commits.webkit.org/251255@main>

Reviewed commits have been landed. Closing PR #1265 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2022-06-02 22:43:13 PDT
<rdar://problem/94330783>
Comment 4 Alexey Proskuryakov 2022-06-02 23:40:01 PDT
Is this actually an optimization? Seems like loop un-unrolling, this has to be slower than before?
Comment 5 Chris Dumez 2022-06-03 07:38:30 PDT
(In reply to Alexey Proskuryakov from comment #4)
> Is this actually an optimization? Seems like loop un-unrolling, this has to
> be slower than before?

I started A/B testing to confirm. In this case, the length of the literal is known at build time and the function is inlined so I wouldn't expect this to regress. However, I believe that appending all the characters at once to the Vector is beneficial so that it can make appropriate decisions internally about resizing its buffer.

We'll see.