speed up ym computation