ReactPerf, reuse code for creating sorted and pruned results

Duplicated code moved into function.