Skip to content
Permalink
Browse files

Make "".ord orders of magitude faster

.ord on the empty string returns Nil.  But the return value had an Int:D
constraint on it.  Which is ok, but a lot of needless work in the case of
Nil being returned.  Fixed by removing the constraint.
  • Loading branch information...
lizmat committed Sep 22, 2018
1 parent 6ee5f75 commit b22edce40206d515851937b246d0afabe578d3e2
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/core/Str.pm6
@@ -2960,7 +2960,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
}

proto method ord(|) {*}
multi method ord(Str:D: --> Int:D) {
multi method ord(Str:D:) {
nqp::chars($!value)
?? nqp::p6box_i(nqp::ord($!value))
!! Nil;

0 comments on commit b22edce

Please sign in to comment.
You can’t perform that action at this time.