diff options
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 8926be6bb..f2f5a372b 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -4044,7 +4044,12 @@ void GlobalObject::reload() registry->clear(this->vm()); this->requireMap()->clear(this->vm()); - this->vm().heap.collectSync(); + + // If we run the GC every time, we will never get the SourceProvider cache hit. + // So we run the GC every other time. + if ((this->reloadCount++ + 1) % 2 == 0) { + this->vm().heap.collectSync(); + } } extern "C" void JSC__JSGlobalObject__reload(JSC__JSGlobalObject* arg0) |