in reply to Script to create huge sample files
Would it not be faster just to divide the required size by the size of the initial file and generate it in a loop running that number of times? (you could randomize the input's order if required). If concatenate the input into a single string or array and then only need to write once. In fact you could even simply do something like this:
$output = $input x (length $input / length $output);
and then write;