On an item with 100 statements, 100 reference sections are created. Each is either toggled if it contains at least one reference, or not toggled if it is empty. This is decided in statementview, but not passed to the toggler. The toggler must to an expensive visibility check on the reference section. This can easily be avoided.
On my local machine (with all caching disabled, and therefor way slower than in production) this saves about 300ms on an item with 100 statements.
Patches for review: