the test version of spare_optimized.pl