Skip to content

Improve conversation loading performance

As part of #230 (closed) I did research, and top offenders turned out to be:

  • add_email() takes ≈25..50 ms.
  • yield throttle_loading() takes a lot, 150..250 ms every call.

So, I dared to move the yield throttle_loading(); out of the foreach (see the commit), and here're results of measuring the foreach+throttle_loading before and after the change, for loading a 134 mails discussion:

before 51110.635 ms
after   4731.387 ms

The time dropped down a lot. Now, I see that this could worsen experience in a sense that conversation won't visibly start loading after being clicked. However, current way of loading would only make sense if it allowed one to peek at mails being loaded; and this is not currently true. If you click a mail whilst stuff is loading, you gonna get jumps up and down, and won't be able to read anything until loading stops. Worse: 60% of cases you can't even read the last mail because of jumps for loading.

With all that said, I think this will actually improve user experience; in particular, it's 100% of cases that a user can read the last email, whilst the rest of conversation being loaded.

Edited by Michael Gratton

Merge request reports