Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b4f60d6c8f3d1ba9b7c3096264c09de05e747f3d
https://github.com/WebKit/WebKit/commit/b4f60d6c8f3d1ba9b7c3096264c09de05e747f3d
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-24 (Mon, 24 Aug 2026)
Changed paths:
M Source/WebCore/Modules/cache/DOMCacheEngine.cpp
M Source/WebKit/NetworkProcess/storage/CacheStorageCache.cpp
Log Message:
-----------
Avoid redundant URL copies on Cache API query paths
https://bugs.webkit.org/show_bug.cgi?id=322383
rdar://185665260
Reviewed by Chris Dumez.
Two spots on the Cache API lookup path copied a URL only to throw the copy
away.
DOMCacheEngine::matchURLs() copied both the request URL and the cached record
URL into locals before comparing them, but the copies only exist so that
setQuery({ }) can strip the query strings when CacheQueryOptions::ignoreSearch
is set. When ignoreSearch is false -- the common case -- both copies are
discarded unmodified. Take that path first and compare in place.
CacheStorageCache::computeKeyURL() built a whole URL just to call
removeQueryAndFragmentIdentifier() on it and read back the string. Truncate
the URL's string directly instead, which is what
removeQueryAndFragmentIdentifier() does internally, and which also skips the
substring allocation entirely for URLs that have no query or fragment.
Together these run once per bucket lookup plus once per record examined, for
every match(), matchAll(), keys(), delete() and put(), as well as addAll()'s
duplicate-request check.
No change in behavior.
* Source/WebCore/Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::matchURLs):
* Source/WebKit/NetworkProcess/storage/CacheStorageCache.cpp:
(WebKit::CacheStorageCache::computeKeyURL):
Canonical link: https://commits.webkit.org/319765@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications