Skip to content

Commit

Permalink
Make int @a.append(int @b) 6x faster
Browse files Browse the repository at this point in the history
by not making it take the long, slurpy array -> flattening route
  • Loading branch information
lizmat committed Feb 28, 2016
1 parent c70a18e commit ced5fbf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/native_array.pm
Expand Up @@ -96,6 +96,9 @@ my class array does Iterable is repr('VMArray') {
nqp::push_i(self, $value);
self
}
multi method append(array:D: int @values) {
nqp::splice(self,@values,nqp::elems(self),0)
}
multi method append(array:D: @values) {
fail X::Cannot::Lazy.new(:action<push>, :what(self.^name))
if @values.is-lazy;
Expand Down

0 comments on commit ced5fbf

Please sign in to comment.