You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the syntax of the normalization result is already known, the algorithm guarantees that the resulting string is conformant to the syntax. However, Some part of this crate uses general and public interface to convert string types (such as TryFrom::try_from instead of unsafe counterparts and debug_assert!).
This kind of "should fail only in case of bug" test should basically only be run in debug build if the performance is important.
Non-allocating algorithm even when alloc or std is available
In this algorithm, the extra string iteration is necessary if . or .. exists in the deep compontent of the path, because the constant-sized queue is used in order to support non-alloc usage.
However, most of the use case of this crate would be web-related and thus std would be available, so in that case more efficient implementation would be possible. (For example, pre-allocating extra buffer and modifying it inline.)
Other parts that uses core::fmt::Display for serialization could also be improved using the memory allocation.
The text was updated successfully, but these errors were encountered:
There is a lot of room for improvement.
Forced validation which can fail only by a bug
For example, this part.
iri-string/src/normalize.rs
Lines 641 to 657 in f95d50a
When the syntax of the normalization result is already known, the algorithm guarantees that the resulting string is conformant to the syntax. However, Some part of this crate uses general and public interface to convert string types (such as
TryFrom::try_from
instead of unsafe counterparts anddebug_assert!
).This kind of "should fail only in case of bug" test should basically only be run in debug build if the performance is important.
Non-allocating algorithm even when
alloc
orstd
is availableFor example, this part.
iri-string/src/normalize/path.rs
Lines 190 to 199 in f95d50a
iri-string/src/normalize/path.rs
Lines 233 to 247 in f95d50a
In this algorithm, the extra string iteration is necessary if
.
or..
exists in the deep compontent of the path, because the constant-sized queue is used in order to support non-alloc
usage.However, most of the use case of this crate would be web-related and thus
std
would be available, so in that case more efficient implementation would be possible. (For example, pre-allocating extra buffer and modifying it inline.)Other parts that uses
core::fmt::Display
for serialization could also be improved using the memory allocation.The text was updated successfully, but these errors were encountered: