Skip to content

Commit dc5c9e2

Browse files
committed
Use separate sub for logged URL rewrites
callsame and slurpy handling are both slow.
1 parent aaf5fd8 commit dc5c9e2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

htmlify.p6

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ monitor UrlLog {
6262
method log($url) { @!URLS.push($url) }
6363
}
6464
my $url-log = UrlLog.new;
65-
&rewrite-url.wrap(sub (|c){
66-
$url-log.log(my \r = callsame);
65+
sub rewrite-url-logged(\url) {
66+
$url-log.log: my \r = rewrite-url url;
6767
r
68-
});
68+
}
6969

7070
use experimental :cached;
7171

@@ -133,7 +133,7 @@ sub header-html($current-selection, $pod-path) is cached {
133133

134134
sub p2h($pod, $selection = 'nothing selected', :$pod-path = Nil) {
135135
pod2html $pod,
136-
:url(&rewrite-url),
136+
:url(&rewrite-url-logged),
137137
:$head,
138138
:header(header-html($selection, $pod-path)),
139139
:footer(footer-html($pod-path)),
@@ -751,7 +751,7 @@ sub write-search-file() {
751751
qq[[\{ category: "{
752752
( @docs > 1 ?? $kind !! @docs.[0].subkinds[0] ).wordcase
753753
}", value: "$name",
754-
url: " {rewrite-url(@docs.[0].url).subst(\, %5c, :g).subst('"', '\"', :g).subst(?, %3F, :g) }" \}
754+
url: " {rewrite-url-logged(@docs.[0].url).subst(\, %5c, :g).subst('"', '\"', :g).subst(?, %3F, :g) }" \}
755755
]] # " and ?
756756
}
757757
}).flat;

0 commit comments

Comments
 (0)