What makes the Gmail API more efficient than IMAP?

I am trying to better understand the Gmail API . One of the claimed benefits of the Gmail API is that it can "significantly improve performance over IMAP." What aspects of the Gmail API and protocol allow it to be more efficient than IMAP?

+5
source share
2 answers

For example, IMAP has the concept of a "mailbox" and supports this in order to preserve the sequence number for each message. In IMAP Gmail, since each label is a folder, which means that we need to keep the sequence of each message on each label. For something like "All Mail," which can be 1,000,000 messages, it's hard to track this on the server.

Things like threads are also foreign to IMAP, but are native to Gmail. The Gmail backend is optimized for threading support as well as the Gmail API. If you want to receive all messages in the stream, this is one call in the API.

Dramatic performance improvements are API use cases that make sense (like web and mobile apps). If you want to synchronize the entire mailbox, IMAP can offer good or better performance, given the possibility of caching an authenticated connection, etc.

+6
source

The best way to answer this is to compare Gmail API Documents with the IMAP Protocol Specification and see what types of operations they allow. All that allows you

  • do more work on the server side instead of the client side,
  • use fewer rounds
  • send and receive only the data that interests you, or
  • Cache Status Locally

going to increase productivity.

Some specific examples: (I just did IMAP and had no experience with the Gmail API, so my examples may not be valid. As I said, read the docs for the full story.)

+4
source

Source: https://habr.com/ru/post/1200854/


All Articles