LibWasm: Replace a hashtable with an RBTree to make instantiation faster

...by about 40%.
This commit is contained in:
Ali Mohammad Pur 2024-07-18 03:41:06 +02:00 committed by Andreas Kling
commit 8cf0f36f7d
Notes: sideshowbarker 2024-07-18 23:45:29 +09:00
2 changed files with 13 additions and 6 deletions

View file

@ -8,7 +8,7 @@
#include <AK/COWVector.h>
#include <AK/Debug.h>
#include <AK/HashTable.h>
#include <AK/RedBlackTree.h>
#include <AK/SourceLocation.h>
#include <AK/Tuple.h>
#include <AK/Vector.h>
@ -18,6 +18,10 @@
namespace Wasm {
struct Context {
struct RefRBTree : RefCounted<RefRBTree> {
RedBlackTree<size_t, FunctionIndex> tree;
};
COWVector<FunctionType> types;
COWVector<FunctionType> functions;
COWVector<TableType> tables;
@ -27,7 +31,7 @@ struct Context {
COWVector<bool> datas;
COWVector<ValueType> locals;
Optional<u32> data_count;
AK::HashTable<FunctionIndex> references;
RefPtr<RefRBTree> references { make_ref_counted<RefRBTree>() };
size_t imported_function_count { 0 };
};