lo48576 / iri-string

String types for URIs/IRIs.
Apache License 2.0
15 stars 3 forks source link

Do not re-iterate path segments on normalization when no more dot segments are found #27

Closed lo48576 closed 2 years ago

lo48576 commented 2 years ago

normalize::path::PathToNormalize::fmt_write_normalize iterates all the segments first, and optionally itearates suffix multiple times again if the path is too deep.

At every scan, the function can know whether the dot segments remains in the rest of the input. If there remains no dot segments, then no more scan is required and only the thing to do is writing slashes and percent encoding.

This will make the path normalization efficient (ideally O(1) for paths without dot segments even when the path is deeeeeeep).