Skip to content
Permalink
Browse files

Bind tai to Instant.tai, rather than assigning

Since Instants are value types, there is no point wasting a Scalar
on each created Instant.  This makes Instant:D.SET-SELF() about 5x
as fast, and saves one Scalar allocation per Instant.
  • Loading branch information...
lizmat committed Jan 4, 2019
1 parent 59bafb8 commit f2ed3db750129b44fd815ead51164095cd86b15a
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/core/Instant.pm6
@@ -8,7 +8,8 @@ my class Instant is Cool does Real {
# Rakudo::Internals.initial-offset. Thus, $.tai matches TAI from 1970
# to the present.

method SET-SELF($!tai) { self } # cannot be private because of operators
# cannot be private because of operators
method SET-SELF(\tai) { $!tai := tai; self }

method new(*@) { X::Cannot::New.new(class => self).throw }

0 comments on commit f2ed3db

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