small optimisations for sampling interrupt handler
further optimisations