Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Speed up build by 25%, almost totally remove duplicated path errors
  • Loading branch information
samcv committed Jan 23, 2017
1 parent 998bc26 commit 00b15d7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions htmlify.p6
Expand Up @@ -962,7 +962,15 @@ sub write-qualified-method-call(:$name!, :$pod!, :$type!) {
return if $name ~~ / '/' /;
spurt "html/routine/{escape-filename $type}.{escape-filename $name}.html", p2h($p, 'routine');
}

sub get-temp-filename {
state %seen-temps;
my $temp = join '-', %*ENV<USER> // 'u', (^1_000_000).pick, 'pod_to_pyg.pod';
while %seen-temps{$temp} {
$temp = join '-', %*ENV<USER> // 'u', (^1_000_000).pick, 'pod_to_pyg.pod';
}
%seen-temps{$temp}++;
$temp;
}
sub highlight-code-blocks(:$no-proc-async = False) {
if !$proc.started {
say "Starting highlights worker thread";
Expand All @@ -975,7 +983,7 @@ sub highlight-code-blocks(:$no-proc-async = False) {
return default($node);
}
}
my $basename = join '-', %*ENV<USER> // 'u', (^100_000).pick, 'pod_to_pyg.pod';
my $basename = get-temp-filename();
my $tmp_fname = "$*TMPDIR/$basename";
spurt $tmp_fname, $node.contents.join;
LEAVE try unlink $tmp_fname;
Expand Down

0 comments on commit 00b15d7

Please sign in to comment.