xmtp / libxmtp

LibXMTP is a shared library encapsulating the core functionality of the XMTP messaging protocol, such as cryptography, networking, and language bindings.
MIT License
48 stars 21 forks source link

Improve Client Creation Performance #1352

Open nplasterer opened 1 day ago

nplasterer commented 1 day ago

The create method takes both an address and an inboxId. When creating a client for the first time, an apiClient is initialized to call getOrCreateInboxId, and another is created during create. This double initialization contributes to the performance issue. My initial thought was that create should only take an address, and we should handle fetching or creating the inboxId internally. However, we’re constrained by the need to pass the database path to create, and the database path is based on the inboxId. This means the inboxId must be known before calling create.

Lets think about how we might be able to improve this long term.

nplasterer commented 1 day ago

Okay I'm going deep on the performance and I'm find 2 areas in particular that are really bad