optionally use cython-accelerated algorithms