Implement LinkedHashMap in Blink wtf |
||||||
Issue descriptionWeb IDL defines "maplike" as an ordered list of key–value pairs in the spec, https://heycam.github.io/webidl/#idl-maplike If wtf can provide LinkedHashMap, we can implement maplike class in a straight-forward way. Here is a list of maplike classes today we have. - MIDIInputMap - MIDIOutputMap - RTCStatsReport - AudioParamMap
,
Jun 28 2017
yutak: Would you take a look at this?
,
Jun 28 2017
For many of these maps which are fairly small, flat vector storage (i.e., Vector<pair<key, value>>) with a nicer API might be more efficient than a linked hash map. Worth considering multiple data structure choices for these uses.
,
Jun 29 2017
In my use case of #1, it will contain thousands elements, but it may be exceptional case. Maplike implementation could have such a common API that is internally realized by vector and provide an interface for maplike users, rather than adding it to wtf?
,
Jun 29 2017
We already have a setlike one. Actually, two: ListHashSet and LinkedHashSet. If I understand correctly, I think you can emulate a maplike by providing a custom HashFunctions to LinkedHashSet. I'm a bit hesitent to add a new HashTable-based container now, because its code is pretty messy and I'm now in the process of refactoring it. In HashTable v2, I can certainly consider introducing LinkedHashMap. Re flat vector: if we need to keep doing lookups and mutations, it can easily cause O(N^2)-time operations. O(N^2) is really bad and I'm against introducing a container that can potentially lead to O(N^2) operations.
,
Jul 4 2017
Upgrading from Untriaged to Available to get it out of the bindings triage queue. yutak@, feel free to assign it to yourself or block on your HashTable v2 bug if you feel that's appropriate.
,
Sep 18 2017
,
Sep 18
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Sep 19
IIUC, the current implementation looks a sort of #c4, IDL maplike's implementations need to implement blink::Maplike<KeyType, ValueType>. The implementation can use Vector, LinkedHashSet, or anything else depending on the typical use cases and the typical size. From PoV of bindings, this looks okay as is. Thus I remove Blink>Bindings, but feel free to add it back. Probably the implementations still want to use LinkedHashMap. So, I leave this issue to be open. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by toyoshim@chromium.org
, Jun 28 2017