Bug 227101 - [JSC] Optimize JSON.parse with small data by changing Identifier pool mechanism
Summary: [JSC] Optimize JSON.parse with small data by changing Identifier pool mechanism
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-16 16:52 PDT by Yusuke Suzuki
Modified: 2021-06-19 00:38 PDT (History)
7 users (show)

See Also:


Attachments
Patch (13.49 KB, patch)
2021-06-16 16:55 PDT, Yusuke Suzuki
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2021-06-16 16:52:03 PDT
[JSC] Optimize JSON.parse with small data by changing Identifier pool mechanism
Comment 1 Yusuke Suzuki 2021-06-16 16:55:37 PDT
Created attachment 431622 [details]
Patch
Comment 2 Mark Lam 2021-06-16 18:33:44 PDT
Comment on attachment 431622 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431622&action=review

r=me with some suggestions.

> Source/JavaScriptCore/ChangeLog:10
> +        if JSON.parse is invoked for small data. This patch changes this pool mechanism so that we do not allocate
> +        Identifiers until we really need.

I suggest adding a bit more detail:
"This patch changes this pool mechanism so that we do not allocate Identifiers until we really need." => "This patch changes this pool mechanism so that we do not waste effort allocating null Identifiers to pre-populate the recent identifiers pool. Instead, we now use a m_recentIdentifiersIndex uint8_t array to indicate whether there's a cached recent identifier for each given first character."

> Source/JavaScriptCore/runtime/LiteralParser.cpp:174
> +    if (indexPlusOne) {

I see.  The reason for using indexPlusOne instead if index is so that 0 can mean no entry.  I think this is worth a comment.
Comment 3 Yusuke Suzuki 2021-06-16 19:04:19 PDT
Comment on attachment 431622 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431622&action=review

Thanks

>> Source/JavaScriptCore/ChangeLog:10
>> +        Identifiers until we really need.
> 
> I suggest adding a bit more detail:
> "This patch changes this pool mechanism so that we do not allocate Identifiers until we really need." => "This patch changes this pool mechanism so that we do not waste effort allocating null Identifiers to pre-populate the recent identifiers pool. Instead, we now use a m_recentIdentifiersIndex uint8_t array to indicate whether there's a cached recent identifier for each given first character."

Changed.

>> Source/JavaScriptCore/runtime/LiteralParser.cpp:174
>> +    if (indexPlusOne) {
> 
> I see.  The reason for using indexPlusOne instead if index is so that 0 can mean no entry.  I think this is worth a comment.

Added.
Comment 4 Yusuke Suzuki 2021-06-16 20:10:06 PDT
Committed r278971 (238897@main): <https://commits.webkit.org/238897@main>
Comment 5 Radar WebKit Bug Importer 2021-06-16 20:11:36 PDT
<rdar://problem/79429814>
Comment 6 Yusuke Suzuki 2021-06-19 00:38:39 PDT
This improved JetStream2/FlightPlanner by 25% in some devices too!