mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +00:00
Preallocate the maximum number of FileHandle pointers (fds) in every process.
This could even use a more specific data structure since it doesn't need the grow/shrink capabilities of a vector.
This commit is contained in:
parent
fce81d376c
commit
065f0aee35
Notes:
sideshowbarker
2024-07-19 18:34:54 +09:00
Author: https://github.com/awesomekling
Commit: 065f0aee35
4 changed files with 37 additions and 18 deletions
11
AK/Vector.h
11
AK/Vector.h
|
@ -172,6 +172,17 @@ public:
|
|||
m_impl = newImpl;
|
||||
}
|
||||
|
||||
void resize(size_t new_size)
|
||||
{
|
||||
ASSERT(new_size >= size());
|
||||
if (!new_size)
|
||||
return;
|
||||
ensureCapacity(new_size);
|
||||
for (size_t i = size(); i < new_size; ++i)
|
||||
new (m_impl->slot(i)) T;
|
||||
m_impl->m_size = new_size;
|
||||
}
|
||||
|
||||
class Iterator {
|
||||
public:
|
||||
bool operator!=(const Iterator& other) { return m_index != other.m_index; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue