Skip to content

Add splice #39

Description

@nnethercote

ThinVec currently lacks the splice method. In rust-lang/rust#104754 I converted a bunch of Vec instances in rustc to ThinVec for some performance wins. I had to change one use of splice like this:

-                alternatives.splice(idx..=idx, inner);
+ 
+                // Equivalent to `alternatives.splice(idx..=idx, inner);`.
+                alternatives.remove(idx);
+                for p in inner.into_iter().rev() {
+                    alternatives.insert(idx, p);
+                }

which could cause quadratic behaviour.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions