[Webkit-unassigned] [Bug 285160] New: Improve DOMStringList::contains() from O(n) to O(1)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 25 20:40:18 PST 2024
https://bugs.webkit.org/show_bug.cgi?id=285160
Bug ID: 285160
Summary: Improve DOMStringList::contains() from O(n) to O(1)
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Keywords: GoodFirstBug
Severity: Normal
Priority: P2
Component: DOM
Assignee: webkit-unassigned at lists.webkit.org
Reporter: karlcow at apple.com
https://searchfox.org/wubkat/rev/36d40c7dfd972e688c9c0febea6821825a85d6ac/Source/WebCore/dom/DOMStringList.cpp#38-48
```cpp
bool DOMStringList::contains(const String& string) const
{
// FIXME: Currently, all consumers of DOMStringList store fairly small lists and thus an O(n)
// algorithm is OK. But this may need to be optimized if larger amounts of data are
// stored in m_strings.
for (auto& value : m_strings) {
if (value == string)
return true;
}
return false;
}
```
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20241226/258d0800/attachment-0001.htm>
More information about the webkit-unassigned
mailing list