WIP: Don't overwork in load when we don't need too
Description
I've recently been looking at how we can remove the concept of update state and started by trying to remove Pipeline.resolve_elements's dependency on Element._update_state. In theory, once we've resolved the elements key's and cached state, this should be enough to show a plan.
However, when looking into this, I noticed that bst show foo.bst where foo.bst was the base element, was entering update state 3 times.
This is because in Stream.load_selection (more specifically, Stream._load(), we are setting elements as required, regardless of whether we're spawning the scheduler or not.
This MR introduces an early early to Stream._load() which ensures that, for the appropriate commands, we don't overwork.
Benchmarks
Note that 'master' was at: 1233899f, at which jennis/load_sometimes_overworks was rebased on top of.
Linux (Debian) - Showing the debian stack (~75000 elements)
Time
| master | jennis/load_sometimes_overworks | |
|---|---|---|
| show | 94.2s | 82.09s |
Max-rss
| master | jennis/load_sometimes_overworks | |
|---|---|---|
| show | 1671.0M | 1666.0M |
WSL - Showing the debian stack (~75000 elements)
Time
| master | jennis/load_sometimes_overworks | |
|---|---|---|
| show | 97.02s | 80.57s |
Max-rss
| master | jennis/load_sometimes_overworks | |
|---|---|---|
| show | 1419.0M | 1418.0M |