Use pooling to avoid reallocating temporary arrays

Also fix a missing dependency