-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JSC] Accelerate JSONAtomStringCache
https://bugs.webkit.org/show_bug.cgi?id=269027 rdar://122590409 Reviewed by Mark Lam. This patch makes JSON parsing faster by embedding small string content itself into the cache. AtomString is stored in the per-thread hash table. And to get that, we need to do hash-table lookup, which is costly. These cache can avoid doing that. But still, to check the cache validity, we are still accessing to the string content of the AtomString. While the input string content is almost always already in CPU cache since we created this input string, AtomString content is very unlikely in the CPU cache. So if we can put this content in much more CPU friendly place, we can avoid cache miss much. In this patch, we leverage the fact that this cache only stores very small strings. So instead of using content inside AtomString, we also copy the string content into the cache's slot itself. So string comparison does not encounter cache miss and accelerate the lookup performance. Good part of AtomString is that, after getting this pointer, we rarely access to the string content of AtomString, so now, we can avoid access to this string content in majority of cases. * Source/JavaScriptCore/runtime/JSONAtomStringCache.h: (JSC::JSONAtomStringCache::makeIdentifier): (JSC::JSONAtomStringCache::clear): (JSC::JSONAtomStringCache::cacheSlot): (JSC::JSONAtomStringCache::cache): Deleted. * Source/JavaScriptCore/runtime/JSONAtomStringCacheInlines.h: (JSC::JSONAtomStringCache::make): * Source/WTF/wtf/text/StringCommon.h: Canonical link: https://commits.webkit.org/274348@main
- Loading branch information
1 parent
8099f94
commit 35a17ac
Showing
3 changed files
with
34 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters