mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:27:46 +00:00
LibJS: Recycle up to 64 HeapBlocks to improve performance :^)
This patch adds a BlockAllocator to the GC heap where we now cache up to 64 HeapBlock-sized mmap's that get recycled when allocating HeapBlocks. This improves test-js runtime performance by ~35%, pretty cool! :^)
This commit is contained in:
parent
d2149c153c
commit
e9081a2644
6 changed files with 101 additions and 8 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibCore/Forward.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/Allocator.h>
|
||||
#include <LibJS/Heap/BlockAllocator.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
|
@ -72,6 +73,8 @@ public:
|
|||
void defer_gc(Badge<DeferGC>);
|
||||
void undefer_gc(Badge<DeferGC>);
|
||||
|
||||
BlockAllocator& block_allocator() { return m_block_allocator; }
|
||||
|
||||
private:
|
||||
Cell* allocate_cell(size_t);
|
||||
|
||||
|
@ -103,6 +106,8 @@ private:
|
|||
|
||||
HashTable<MarkedValueList*> m_marked_value_lists;
|
||||
|
||||
BlockAllocator m_block_allocator;
|
||||
|
||||
size_t m_gc_deferrals { 0 };
|
||||
bool m_should_gc_when_deferral_ends { false };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue