Description
Describe the bug
Testing for #8663 eventually led me to the major contributor of the slowdown and memory consumption: util.getManifest
. This isn't strictly a bug, but might be worth just noting in the tsdoc for the function so that no-one else makes this mistake.
Calling util.getManifest
is quite expensive: on my machine it takes 150-200ms per call, and since there's a call to Buffer.toString
somewhere in there, it can also cause a huge allocation of memory if called repeatedly. In my case, I was stupid and was calling it per-mod and that can balloon to the point of crashing Vortex.
To Reproduce
Steps to reproduce the behavior:
- Repeat any loop 100+ times (or 1000 if you've got a lot of RAM)
- Call
util.getManifest()
every loop - It will be fairly slow but more importantly the heap will rapidly grow in size
Expected behavior
This isn't really a bug, just might be worth throwing a cautionary note in the tsdoc. If you really wanted, a super-short-lived cache could also avoid this, but I think that's probably a bit much for a problem that should only show up if an extension developer is doing things wrong.
Platform (please complete the following information):
- OS: Windows 10
- Vortex Version 1.4.3