Bug 54973 - We need a data structure with efficient access by key, and with order for the elements
Summary: We need a data structure with efficient access by key, and with order for the...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
Depends on:
Blocks: 54972
  Show dependency treegraph
 
Reported: 2011-02-22 10:47 PST by Benjamin Poulain
Modified: 2011-02-25 08:20 PST (History)
7 users (show)

See Also:


Attachments
Patch (27.80 KB, patch)
2011-02-22 10:57 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2011-02-22 10:47:42 PST
HashSet has ListHashSet for having a set with order.
To implement 17425 effectively, we need the same kind of data structure for HashTable.
Comment 1 Benjamin Poulain 2011-02-22 10:57:35 PST
Created attachment 83342 [details]
Patch
Comment 2 Benjamin Poulain 2011-02-22 11:00:52 PST
Maciej suggested I split the patch of 17425 to simplify the review. So I am splitting the diff, here is the data structure.

Same comment as on 17425: ListHashTable interface is a lot like ListHashSet. I did not do the custom allocator because that would make the patch quite more complex and that does not have as much value for this use case as it had for the ListHashSet.
Comment 3 Geoffrey Garen 2011-02-22 11:01:32 PST
To match HashMap, I think you should call this class ListHashMap, not ListHashTable. HashTable is the name we use for the underlying data type these classes are implemented in terms of.
Comment 4 Benjamin Poulain 2011-02-22 11:12:56 PST
(In reply to comment #3)
> To match HashMap, I think you should call this class ListHashMap, not ListHashTable. HashTable is the name we use for the underlying data type these classes are implemented in terms of.

I really meant HashTable. If you look at the data structure, it uses an extractor to get the data out of the content.

HashMap is using HashTable, storing a pair<>, and extracting the first element as the key. I think it was cleaner to use HashTable for RenderBlock because of the kind of usage we have with the FloatingObjects.
Comment 5 Eric Seidel (no email) 2011-02-24 02:56:40 PST
Mjs is your man for this review.  Pick on him in #webkit.
Comment 6 Benjamin Poulain 2011-02-24 13:15:56 PST
Comment on attachment 83342 [details]
Patch

Maciej suggested to extend ListHashSet with template taking HashTranslator like for HashSet.

That seems a good idea. I clear the review flag for now and I will extend ListHashSet tomorrow.
Comment 7 Benjamin Poulain 2011-02-25 08:20:23 PST
I extended ListHashSet, and updated 54972.