Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
FROGGS committed Jun 25, 2013
1 parent 4f2a3c8 commit 9009440
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Perl6/Metamodel/Mixins.nqp
Expand Up @@ -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($_)) }
Expand Down

0 comments on commit 9009440

Please sign in to comment.