added small efficiency increase

the maximum possible number of spaces for any given line is saved.
Searching for more spaces will be stopped when they are all found for a
slight efficiency increase