* Avoid allocating a Vec when precomputed segments lengths is provided. * improved using option type. * we don't even need option type as Vec::new() doesn't allocate. * clean up