mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
Around 6 months ago, @styfle brought to my attention how `rename()` in build-utils used `reduce()` and could be written better. So, I rewrote it. Before, the code would create a new `Files` object and copy the contents of the previous `Files` object. This caused heavy garbage collection and memory thrashing. Instead, I created a single `Files` object, then add the files to it. Results: | # Files | Before | After | |---|---|---| | 1,000 | 75 ms | 1 ms | | 10,000 | 10.6 s | 7 ms | | 20,000 | 44.6 s | 16 ms | | 30,000 | 105.5 s | 22 ms | | 100,000 | Too long | 73 ms |