Batching helps because per-request overhead (loading weights into the compute path, kernel launch setup, whatever fixed cost a single call pays) doesn't scale with the number of requests inside a batch -- it's paid once per batch, not once per request. Quantifying that savings is what tells you whether batching is actually worth the added complexity for a given workload.
Write compare_batching_strategies(num_requests, max_batch_size, per_request_ms, per_batch_overhead_ms). Processing individually pays the fixed overhead on every single request; batching in groups of up to max_batch_size pays it once per batch. Return a dict with "individual_total_ms", "batched_total_ms", and "savings_ms".
No results yet
Run your code to check it against the examples, or submit to run every test.