Skip to content

Instantly share code, notes, and snippets.

@thibaultduponchelle
Created November 16, 2020 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thibaultduponchelle/e59322a0b01bfa31d66ef602a5d1f649 to your computer and use it in GitHub Desktop.
Save thibaultduponchelle/e59322a0b01bfa31d66ef602a5d1f649 to your computer and use it in GitHub Desktop.
Terrible unshift
# Performs VERY well
my int @a = ();
for (1..4000000) -> int $item {
@a.push($item);
}
# Performs VERY bad
my int @a = ();
for (1..1000000) -> int $item {
@a.unshift($item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment