supaglue-labs / supaglue

Open source user-facing product integrations

Home Page:https://docs.supaglue.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider sticking to only snakecase or camelcase in `api`, or write explicit mappers for performance

albertyfwu opened this issue · comments

commented

Right now, sometimes when there are a lot of list queries for contacts, accounts, etc. the nodejs event loop latency spikes. Something suspicious is that mapping 1000 contacts from camelcase to snakecase, for example, took around 100-150ms in testing.

Instead, an explicit mapper cut this time down to 1ms.

This may be the cause of our health checks occasionally failing the 1s timeout.

The snakecase-keys library seems to be very expensive. Maybe we can:

  1. Write explicit mappers (GPT can help with this, or we can have a script to generate the mappers ahead of time?) like newContact = { foo_bar: contact.fooBar, bar_foo: contact.barFoo, ...}, or
  2. stick to camelcase/snakecase throughout our code