This isn't even really a fair benchmark (testing testing), as the hacky version does more than the proxy, but even without the benchmarks ended up within the same region.
The bottleneck for the Proxy is most definitely the Proxy itself; it ends up plateauing at ~1m ops/sec.
Past that, the next bottleneck is cloning the results array when returning emit
. If we ignore the result there and return null
, we end up getting around 8-9m ops/sec. Slicing with 0
index is the fastest solution I could find, but there may be ways around this where we create custom arrays for each emission.