Skip to content
Permalink
Browse files

Make constraint check on UInt about 15% faster

By using NQP ops.  There seems to be a lot of overhead involved with
"where" base constraints, specifically find_method calls
  • Loading branch information...
lizmat committed Dec 28, 2018
1 parent 537621e commit 922d41b3d0116c9bf67daa196db2717ec63b0b4f
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/core/Int.pm6
@@ -4,7 +4,9 @@ my class X::Numeric::DivideByZero { ... }
my class X::NYI::BigInt { ... }

my class Int { ... }
my subset UInt of Int where {not .defined or $_ >= 0};
my subset UInt of Int where {
nqp::not_i(nqp::isconcrete($_)) || nqp::isge_I($_,0)
}

my class Int does Real { # declared in BOOTSTRAP
# class Int is Cool

0 comments on commit 922d41b

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