Files
chia-blockchain/chia/plotting
dustinfaceandGitHub d9143063ff plotting: Reduce Path.exists calls (#8999)
* plotting: Move plot removals out of `PlotManager.refresh_batch`

Moving this checks up in the trace so that it only runs once for each
refresh cycle reduces `plot_removed` calls per cycle from `batch_count *
plot_count` to `plot_count` only. This checks can be quite expensive
depending on how/where the plots are stored so this should noticeably
improve refresh times in slow setups and large farms even for the
initial refresh cycle. I don't see any downside here considered that
even if a plot gets removed during a refresh cycle (after the checks
run) it will catch it in the next cycle.

**Note**: This has become an issue now (e.g. in #8972) because prior to
way, that it only really processed in batches for the very first run
after a restart. For each repeated refresh cycle it just walked through
all files in one `refresh_batch` call. Now after #8385 fixed this
behavior the checks are called `batch_count * plot_count` for all
refresh cycles, even for each repeated cycle where it was `plot_count`
before.

* plotting: Move `file_path.exists` call down 

There is no point in testing it before here, it only leads to redundant 
calls for repeated refresh cycles. The important point here is just that 
it runs after 

```
if file_path in self.plots:
    return self.plots[file_path]
```

so it could still be moved around differently if there are other 
suggestions, tell me. I even think it might be possible to just drop it 
with no bad impact but lets just move it for now.
2021-10-29 09:29:46 -07:00
..