Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Str.chars instead of inheriting Cool.chars
.chars on strings now runs 41% faster
  • Loading branch information
labster committed Apr 13, 2015
1 parent 8e96e4f commit e28b43d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/Str.pm
Expand Up @@ -1394,6 +1394,16 @@ my class Str does Stringy { # declared in BOOTSTRAP

method unival(Str:D:) { unival(self.ord) };
method univals(Str:D:) { univals(self) };

proto method chars(|) { * }
multi method chars(Str:D:) returns Int:D {
nqp::p6box_i(nqp::chars($!value))
}
multi method chars(Str:U:) returns Int:D {
self.Str; # generate undefined warning
0
}

}


Expand Down

0 comments on commit e28b43d

Please sign in to comment.