Bug 141051 - Store MemoryCache's live decoded resources in a ListHashSet
Summary: Store MemoryCache's live decoded resources in a ListHashSet
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 141292
Blocks:
  Show dependency treegraph
 
Reported: 2015-01-29 14:41 PST by Chris Dumez
Modified: 2022-02-28 03:44 PST (History)
6 users (show)

See Also:


Attachments
Patch (11.44 KB, patch)
2015-01-29 14:48 PST, Chris Dumez
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-01-29 14:41:15 PST
Store MemoryCache's live decoded resources in a ListHashSet instead of a linked list. The frequent operations are:
1. Add items to one end
2. Remove items from the other end or anywhere in the container by value

Using a ListHashSet instead of a manual linked list results in *much* simpler code and is fast for all operations (faster than linked list even for removing an given element from the linked list given its value). The current implementation requires us to keep a lot of pointers up-to-date, which is error prone.

This is a first step towards simplifying the MemoryCache implementation.
Comment 1 Chris Dumez 2015-01-29 14:48:45 PST
Created attachment 245653 [details]
Patch
Comment 2 Antti Koivisto 2015-01-30 02:03:00 PST
Comment on attachment 245653 [details]
Patch

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

> Source/WebCore/loader/cache/MemoryCache.h:142
> +    bool inLiveDecodedResourcesList(CachedResource* resource) const { return m_liveDecodedResources.contains(resource); }

It would be nicer to take a reference.
Comment 3 Chris Dumez 2015-01-30 09:40:48 PST
Committed r179402: <http://trac.webkit.org/changeset/179402>