Code Explainers
Code explainers tagged #batching
python
from itertools import islice from typing import Iterable, Iterator, TypeVar T = TypeVar("T")
Batching an iterable for bulk indexing
generators
batching
lazy-evaluation
Intermediate
7 steps
ruby
class ReportBatcher BATCH_SIZE = 500 def initialize(account)
Batching monthly email summaries in Rails
batching
service-object
background-jobs
Intermediate
7 steps
typescript
export function chunk<T>(items: readonly T[], size: number): T[][] { if (size <= 0 || !Number.isInteger(size)) { throw new RangeError(`chunk size must be a positive integer, got ${size}`); }
Splitting work into sequential batches in TypeScript
generics
async-await
batching
Intermediate
5 steps