Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add infix:<ne>(Str,Str) subs, skip metaop for ne(Any, Any)
Makes string ne much closer in speed to eq by using nqp::isne_s().
28-47% faster, depending on how many of the args are strings.
  • Loading branch information
labster committed Apr 14, 2015
1 parent 8b639ba commit 5bc3954
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/Str.pm
Expand Up @@ -1453,6 +1453,13 @@ multi sub infix:<eq>(str $a, str $b) returns Bool:D {
nqp::p6bool(nqp::iseq_s($a, $b))
}

multi sub infix:<ne>(Str:D \a, Str:D \b) returns Bool:D {
nqp::p6bool(nqp::isne_s(nqp::unbox_s(a), nqp::unbox_s(b)))
}
multi sub infix:<ne>(str $a, str $b) returns Bool:D {
nqp::p6bool(nqp::isne_s($a, $b))
}

multi sub infix:<lt>(Str:D \a, Str:D \b) returns Bool:D {
nqp::p6bool(nqp::islt_s(nqp::unbox_s(a), nqp::unbox_s(b)))
}
Expand Down
1 change: 1 addition & 0 deletions src/core/Stringy.pm
Expand Up @@ -28,6 +28,7 @@ multi sub infix:<eq>(\a, \b) { a.Stringy eq b.Stringy }
proto sub infix:<ne>(Mu $?, Mu $?) is pure { * }
multi sub infix:<ne>($x?) { Bool::True }
multi sub infix:<ne>(Mu \a, Mu \b) { a !eq b }
multi sub infix:<ne>(Any \a, Any \b) { a.Stringy ne b.Stringy }

proto sub infix:<lt>(Mu $?, Mu $?) is pure { * }
multi sub infix:<lt>($x?) { Bool::True }
Expand Down

0 comments on commit 5bc3954

Please sign in to comment.