ENH: use fast sequence API for discover_dimensions

reduces runtime of function by about 20%