Pooled allocation of RandomX VMs

+0.5% speedup on Zen2 when the whole L3 cache is used (16 threads on 3700X/3800X, 32 threads on 3950X).
This commit is contained in:
SChernykh 2020-04-07 18:31:35 +02:00
parent 7f01c5c6f3
commit 6ae37a9519
11 changed files with 68 additions and 61 deletions

View file

@ -39,16 +39,8 @@ namespace randomx {
using VmBase<softAes>::mem;
using VmBase<softAes>::cachePtr;
void* operator new(size_t size) {
void* ptr = AlignedAllocator<CacheLineSize>::allocMemory(size);
if (ptr == nullptr)
throw std::bad_alloc();
return ptr;
}
void operator delete(void* ptr) {
AlignedAllocator<CacheLineSize>::freeMemory(ptr, sizeof(InterpretedLightVm));
}
void* operator new(size_t, void* ptr) { return ptr; }
void operator delete(void*) {}
void setDataset(randomx_dataset* dataset) override { }
void setCache(randomx_cache* cache) override;