23/34
Part 6 of 8 · BandsLearn and do

On one 400-row table, bands on threads were no faster, and on processes about twice as fast

One table of 400 rows by 100 columns, steps [("clip", 0, 900), ("map", heavy), ("sort", 1), ("map", to_fahrenheit), ("head", 300)], bands of 100 rows, median of 3:

RunTime
apply alone0.347 s
bands on 4 threads0.354 s
the same function with a ProcessPoolExecutor of 4 in place of the thread pool, start-up included0.169 s

Threads don't beat the GIL on bands either. On processes, each band is pickled out and back. Only the steps in the list, names and top-level functions, travel with it.

In the editor, in_bands checks the steps, copies the rows and walks the runs from groupby, with ROW_LOCAL and run from above. The whole-table branch is done. Finish the row-local branch: cut, run group on each band with pool, and stitch.