mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:27:45 +00:00
AK+LibRegex+LibWasm: Remove the non-const COWVector::operator[]
This was copying the vector behind our backs, let's remove it and make the copying explicit by putting it behind COWVector::mutable_at(). This is a further 64% performance improvement on Wasm validation.
This commit is contained in:
parent
cced555879
commit
8003bde03d
4 changed files with 14 additions and 22 deletions
|
@ -110,7 +110,7 @@ public:
|
|||
m_detail->m_members.clear();
|
||||
}
|
||||
|
||||
T& at(size_t index)
|
||||
T& mutable_at(size_t index)
|
||||
{
|
||||
// We're handing out a mutable reference, so make sure we own the data exclusively.
|
||||
copy();
|
||||
|
@ -122,13 +122,6 @@ public:
|
|||
return m_detail->m_members.at(index);
|
||||
}
|
||||
|
||||
T& operator[](size_t index)
|
||||
{
|
||||
// We're handing out a mutable reference, so make sure we own the data exclusively.
|
||||
copy();
|
||||
return m_detail->m_members[index];
|
||||
}
|
||||
|
||||
T const& operator[](size_t index) const
|
||||
{
|
||||
return m_detail->m_members[index];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue