Permalink
Browse files

flush an objects cache when mixin in

... if this object already is an mixin. Otherwise when mixin in
several things in a row, it would collect precomputed NFAs and
this would result in bigger files when serializing it.
Example: declare 10 infixes, was 9MB .pir file, is now 1.2MB.
         compiling it to pbc took 49s now takes 0.8s.
  • Loading branch information...
1 parent 4f2a3c8 commit 90094405e880179b7ae4379e78f28d0994823ff3 @FROGGS FROGGS committed Jun 25, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/Perl6/Metamodel/Mixins.nqp
@@ -2,8 +2,11 @@ role Perl6::Metamodel::Mixins {
has $!is_mixin;
method set_is_mixin($obj) { $!is_mixin := 1 }
method is_mixin($obj) { $!is_mixin }
+ method flush_cache($obj) { <...> }
method mixin($obj, *@roles) {
+ # Flush its cache as promised, otherwise outdated NFAs will stick around.
+ self.flush_cache($obj) if !nqp::isnull($obj) || self.is_mixin($obj);
# Work out a type name for the post-mixed-in role.
my @role_names;
for @roles { @role_names.push($_.HOW.name($_)) }

0 comments on commit 9009440

Please sign in to comment.