Issue #2074297 by pwolanin, hussainweb, larowlan: Optimize the code in doGenerate() in the UrlGenerator to take advantage of Drupal path restrictions.