Profiling a simple binary bet from deployed dev api
550ms
Profiling a simple binary bet from a local server.
Tested a version of placebet with no transactions or firebase and it was 218ms
Analysis
The migration will eliminate ~100ms for the firestore transaction
The remaining supabase transaction is ~200ms.
If we remove the transaction
People could double-spend by betting on two markets at the same time
One part of the transaction could error, e.g. creating the bet, while another part succeeds, decrementing your balance. How do we fix that?
// Get data from 2 tables in a single request:
const [users, products] = await pg.multi('SELECT * FROM users; SELECT * FROM products');
[J] It seems like moving the database to be colocated will revolutionize the latency of our app. We should do that and then check this stuff again.