cypht-org / cypht

Cypht: Lightweight Open Source webmail aggregator [PHP, JS]. Supports IMAP/SMTP, JMAP and soon EWS
http://cypht.org
GNU Lesser General Public License v2.1
1.01k stars 163 forks source link

Improve performance for most common operations (view next email, delete email, move email to another folder, etc.) #1144

Closed marclaporte closed 1 month ago

marclaporte commented 3 months ago

As of Cypht 2.2.0, the feature set is getting pretty impressive.

However, performance is slower than Gmail or Roundcube. To illustrate, there is a video of deleting emails in Roundcube/Kolab here: https://github.com/cypht-org/cypht/issues/435

Let's explore how this could be improved.

mercihabam commented 2 months ago

Performance is slow because each operation makes a separate request to the backend service and the IMAP server, even though this is unnecessary in most cases. The most important actions are fetching the message list and fetching the message content. These could be combined, so that once the message list is displayed, the user doesn't need to make another request to view the message content or move to the next message.

Also, actions such as delete, copy, and move should not reload the message list. The optimal solution would be to manage the message state via JavaScript. Instead of requesting a new list from the server, these actions would update the display by modifying the current state.

I'll explore this approach and see how fast it becomes.

mercihabam commented 2 months ago

I avoided combining the two requests because it results in a longer request, causing the user to wait even longer for the list of messages to appear. Instead, I worked on https://github.com/cypht-org/cypht/pull/1252 which improves the message caching to prevent multiple fetches of the same message when requested and ensure that viewing the next email gets done instantly after a delete, move, or archive operation. I'll leave the PR for review. Afterward, we can work on preventing some actions from reloading the page when performed, as this is another performance issue.

kroky commented 2 months ago

1252 looks good - just check if Tiki-master is OK with latest code - not sure about the paths of the new module import.

mercihabam commented 1 month ago

1252 looks good - just check if Tiki-master is OK with latest code - not sure about the paths of the new module import.

Tiki-master isn't OK because those modules are not included in the final site.js. But, this PR (https://github.com/cypht-org/cypht/pull/1264) should fix.

kroky commented 1 month ago

Alright, thanks!