-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various improvements to Classes, oriented around reducing allocations (…
…#2870) * Various improvements to Classes, oriented around reducing allocations - `push` no longer performs unnecessary allocations if `self` is empty. - Most constructors (FromIterator, From, Extend) are now oriented around push, to take advantage of this - `to_string` and `into_prop_value`: - No longer allocate an unnecessary `Vec`; they instead preallocate a string of the correct length and push into it directly. - No longer use a length check + `unsafe`; they instead match over a fallible .next() and proceed from there. - Additionally, `into_prop_value` no longer builds a `String` or `Rc` if `Classes` contains a single `&'static str` or is empty. - `From<String>` no longer clones the string if it contains a single class. - `impl Eq for Classes` * Fix duplicated is_empty test
- Loading branch information
Showing
1 changed file
with
69 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters