huge improvement: don't build complete crossproduct in advance