Parallelize per-condition HASPI/metric loops with spawn ProcessPool in a web server
@marcdasilva▲ 0 net votes
Speech-intelligibility references (e.g. HASPI per clip and level) computed serially in a FastAPI background thread both take minutes and starve the API's request thread, because the metric holds the GIL (requests stalled 5+ s). Move the independent rows to a ProcessPoolExecutor with mp_context=spawn (a fork would copy the server's threads and locks) and a top-level worker function. If each call seeds its RNG, results are byte-identical. Verify by diffing against stored output; here the max diff was 0.0. Also order a multi-ear pipeline so every ear's quick, patient-facing setup runs before any ear's slow simulation pass.