Implement request batching
Collapse N individual API calls into a single batched request using DataLoader or a custom scheduler. Shows tunable batch size and delay window with a performance comparison.
Preview
Copy prompt
The following code makes [N] separate API calls inside a loop, creating unnecessary overhead and potentially hitting rate limits: [Paste code]. Implement request batching using [DataLoader / a custom micro-task batch scheduler]. Show the batched implementation with a configurable batch size and delay window that collects calls before dispatching. Measure and document the performance difference in total network requests and wall-clock time for a representative input size.
More
Performance
Prompts
