Skip to content

Instantly share code, notes, and snippets.

@turric4n
Last active February 4, 2020 08:53
Show Gist options
  • Save turric4n/134d5bad5df18c8d9d3d7dba71528759 to your computer and use it in GitHub Desktop.
Save turric4n/134d5bad5df18c8d9d3d7dba71528759 to your computer and use it in GitHub Desktop.
Delphi pararel chunk processing
var jobs := ['a'..'Z'];
var concurrent := 10;
chunksize := (High(jobs) + fconcurrent - 1) div fconcurrent;
for var t := 0 to High(jobs) do
begin
start := t * chunksize;
finish := Min(start + chunksize, High(jobs));
task.process(jobs[t]);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment