small optimisations for sampling interrupt handler