reorganize code in speed tests