Effect CommunityEC
Effect Community2y ago
42 replies
Patrick Roza

Effectful Schema Transformations: Performance Discrepancies and Solutions

I was seeing quite abysmal performance while using effectful schema transformations, including using request resolvers.
locally it was like 1s vs 80ms. in production it was more like 5s vs 0.5s.
it only does 1 batched request which finishes in like 1ms locally, so it's not waiting on IO. It's basically 1500 records which point to maybe 5 distinct user records.

while debugging the issue, I found in my benchmark suite that:
- using a simple Effect inside a schema, makes it about 400x slower, unless you remove "concurrency": "unbounded" inside schema (then it goes down to about 40x slower)
- using request resolvers inside schema slows down another 5-10x depending on batching, using request resolvers outside schema about 300x slower than resolving directly, using batching/concurrency etc might bring that down to 150x.

for resolving im only measuring returning a sync effect, so of course the scales will change when you have IO bound effects, but seeing these numbers makes me think there may be something wrong.

now I know that micro benchmarks etc are useless, and I barely ever do performance benchmarks, so it's probably not perfect 🙂
Was this page helpful?