Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 35a17ac7fc544202144f2d0f1e93be9ee8402ad4 https://github.com/WebKit/WebKit/commit/35a17ac7fc544202144f2d0f1e93be9ee8402ad4 Author: Yusuke Suzuki <ysuz...@apple.com> Date: 2024-02-09 (Fri, 09 Feb 2024)
Changed paths: M Source/JavaScriptCore/runtime/JSONAtomStringCache.h M Source/JavaScriptCore/runtime/JSONAtomStringCacheInlines.h M Source/WTF/wtf/text/StringCommon.h Log Message: ----------- [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 _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes