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

  1. nnethercote commented on Dec 1, 2022

    @nnethercote
    ContributorAuthor

    There is even a TODO: implement splice? comment in the code.

  2. Gankra commented on Dec 5, 2022

    @Gankra
    Collaborator
  3. marcospb19 commented on Jun 28, 2023

    @marcospb19

    Hey 👋, should this be closed due to #41?

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