Collapsing Is very slow

Collapsing items is incredibly slow, toggling them in a bulk or one by one is very slow and makes the whole document lag and stop working for more than 10 seconds on a relatively small document.