[turbopack] Move empty snapshot filtering into take_snapshot (#90166)
When snapshotting we create a number of iterators to encode every `shard` of the `modified` dashmap.
Some of these shards end up being empty and rarely they might all be empty. To avoid the overhead of opening a write transaction we detect this prior to persisting. Unfortunately this is done in a single threaded pass and can be expensive since there are often thousands of shards.
To improve this we move the filtering into shard production so it can happen concurrently.
This is a small improvment, from vercel-site builds timing the `Finished writing to filesystem cache` event we get
Before: 6.6s 7.8s 7.1s
After: 6.6s 6.5s 6.4s
So a small progression