Performance improvements in the apf_compare functionality in test_lsb.py