mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add a fast path for DisjointChunks::spans()
This commit is contained in:
parent
253f4de302
commit
e9b9527440
Notes:
sideshowbarker
2024-07-17 09:49:48 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/e9b9527440 Pull-request: https://github.com/SerenityOS/serenity/pull/15994
1 changed files with 5 additions and 0 deletions
|
@ -316,6 +316,11 @@ public:
|
|||
{
|
||||
Vector<Span<T>, InlineSize> spans;
|
||||
spans.ensure_capacity(m_chunks.size());
|
||||
if (m_chunks.size() == 1) {
|
||||
spans.append(const_cast<ChunkType&>(m_chunks[0]).span());
|
||||
return DisjointSpans<T, Vector<Span<T>, InlineSize>> { move(spans) };
|
||||
}
|
||||
|
||||
for (auto& chunk : m_chunks)
|
||||
spans.unchecked_append(const_cast<ChunkType&>(chunk).span());
|
||||
return DisjointSpans<T, Vector<Span<T>, InlineSize>> { move(spans) };
|
||||
|
|
Loading…
Reference in a new issue