Skip to content

Commit

Permalink
Merge pull request #4084 from rakudo/speedup-native-multidim-array-ops
Browse files Browse the repository at this point in the history
Fix a shaped array performance problem
  • Loading branch information
lizmat committed Dec 2, 2020
2 parents 0d6278f + f27e212 commit a89d020
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core.c/Rakudo/Internals.pm6
Expand Up @@ -425,12 +425,21 @@ my class Rakudo::Internals {
my Mu $root := nqp::newtype(nqp::knowhow(), 'Uninstantiable');
nqp::setdebugtypename($root, 'MultiDimArray root');
nqp::setparameterizer($root, -> $, $key {
# We "steal" the meta-object for the multi-dim storage.
my $dims := $key.elems.pred;
my $meta := $key.AT-POS(0);
my $type := $key.AT-POS(1);
my $dim_type := nqp::newtype($key.AT-POS(0), 'MultiDimArray');
my $dim_type := nqp::newtype($meta, 'MultiDimArray');
nqp::composetype($dim_type, nqp::hash('array',
nqp::hash('dimensions', $dims, 'type', $type)));
nqp::settypehll($dim_type, 'Raku');
# Make sure the debug name and various caches are propagated
# for native arrays (where this type is exposed to userspace).
if nqp::objprimspec($type) {
nqp::setdebugtypename($dim_type, $meta.name($dim_type));
$meta.publish_method_cache($dim_type);
$meta.publish_type_cache($dim_type);
}
$dim_type
});
nqp::settypehll($root, 'Raku');
Expand Down

0 comments on commit a89d020

Please sign in to comment.