measure time to compute product