Approximtely 50% speed improvement in tests opening a storyview with 8,000 entries.
(I've deferred the indentation adjustments until the next commit so that the git diffs are clearer)
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.