mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 10:06:03 +00:00
LibWasm: Avoid pointless vector copies in Validator::Context
These vector copies accounted for more than 50% of the current runtime of the validator on a large wasm file, this commit makes them copy-on-write to avoid the copies where possible, gaining nearly a 50% speedup.
This commit is contained in:
parent
cefe177a56
commit
cced555879
Notes:
sideshowbarker
2024-07-17 08:27:05 +09:00
Author: https://github.com/alimpfard
Commit: cced555879
Pull-request: https://github.com/SerenityOS/serenity/pull/23550
2 changed files with 17 additions and 15 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/COWVector.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/SourceLocation.h>
|
||||
|
@ -17,15 +18,15 @@
|
|||
namespace Wasm {
|
||||
|
||||
struct Context {
|
||||
Vector<FunctionType> types;
|
||||
Vector<FunctionType> functions;
|
||||
Vector<TableType> tables;
|
||||
Vector<MemoryType> memories;
|
||||
Vector<GlobalType> globals;
|
||||
Vector<ValueType> elements;
|
||||
Vector<bool> datas;
|
||||
Vector<ValueType> locals;
|
||||
Vector<ResultType> labels;
|
||||
COWVector<FunctionType> types;
|
||||
COWVector<FunctionType> functions;
|
||||
COWVector<TableType> tables;
|
||||
COWVector<MemoryType> memories;
|
||||
COWVector<GlobalType> globals;
|
||||
COWVector<ValueType> elements;
|
||||
COWVector<bool> datas;
|
||||
COWVector<ValueType> locals;
|
||||
COWVector<ResultType> labels;
|
||||
Optional<ResultType> return_;
|
||||
AK::HashTable<FunctionIndex> references;
|
||||
size_t imported_function_count { 0 };
|
||||
|
@ -345,7 +346,7 @@ private:
|
|||
Vector<ChildScopeKind> m_entered_scopes;
|
||||
Vector<BlockDetails> m_block_details;
|
||||
Vector<FunctionType> m_entered_blocks;
|
||||
Vector<GlobalType> m_globals_without_internal_globals;
|
||||
COWVector<GlobalType> m_globals_without_internal_globals;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue