Skip to content

Commit

Permalink
Some mixed micro opts
Browse files Browse the repository at this point in the history
- binding instead of assigning
- check the cheapest (and most likely failing) condition first
- use faster existence check (and also check for size)
- another case of if foo -> \bar
- one case of missed .store
  • Loading branch information
lizmat committed Mar 13, 2020
1 parent 859d8f0 commit 5ea1c34
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/core.c/CompUnit/PrecompilationRepository.pm6
Expand Up @@ -391,7 +391,7 @@ Need to re-check dependencies.")
$!RMD("Precompiling $path into $bc ($lle $profile $optimize $stagestats)")
if $!RMD;

my $raku = $*EXECUTABLE.absolute
my $raku := $*EXECUTABLE.absolute
.subst('perl6-debug', 'perl6') # debugger would try to precompile it's UI
.subst('perl6-gdb', 'perl6')
.subst('perl6-jdb-server', 'perl6-j') ;
Expand Down Expand Up @@ -457,11 +457,11 @@ Need to re-check dependencies.")
!! nqp::join('',$err);
}

if not $!RMD and not $stagestats and nqp::elems($err) {
if nqp::elems($err) && not($!RMD || $stagestats) {
$*ERR.print(nqp::join('',$err));
}

unless $bc.e {
unless Rakudo::Internals.FILETEST-ES($bc.absolute) {
$!RMD("$path aborted precompilation without failure")
if $!RMD;

Expand All @@ -481,7 +481,8 @@ Need to re-check dependencies.")
&& nqp::chars($outstr) > 41 {
my $dependency :=
CompUnit::PrecompilationDependency::File.deserialize($outstr);
if $dependency && $dependency.Str -> str $dependency-str {
if $dependency {
my str $dependency-str = $dependency.Str;
unless nqp::existskey($seen,$dependency-str) {
$!RMD($dependency-str)
if $!RMD;
Expand All @@ -498,6 +499,7 @@ Need to re-check dependencies.")
}
}

# HLLize dependencies
my CompUnit::PrecompilationDependency::File @dependencies;
nqp::bindattr(@dependencies,List,'$!reified',$dependencies);

Expand All @@ -508,7 +510,7 @@ Need to re-check dependencies.")
$store.store-unit(
$compiler-id,
$id,
self.store.new-unit(
$store.new-unit(
:$id,
:@dependencies
:$source-checksum,
Expand Down

0 comments on commit 5ea1c34

Please sign in to comment.