Skip to content

Commit 6d8e4ac

Browse files
committed
Add timing info for Volatile::DirTree children cache refill
1 parent 35b937e commit 6d8e4ac

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/Terminal/Widgets/Volatile/DirTree.rakumod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
unit module Terminal::Widgets::Volatile::DirTree;
44

5+
use nano;
6+
7+
use Terminal::Widgets::Common;
58
use Terminal::Widgets::Volatile::Tree;
69

710
constant VTree = Terminal::Widgets::Volatile::Tree;
@@ -40,7 +43,7 @@ class SymLink does Node {
4043
}
4144
}
4245

43-
class Dir does Parent {
46+
class Dir does Parent does Terminal::Widgets::Common {
4447
has VTree::Node:D @!children is built;
4548
has Instant:D $.cache-time .= from-posix-nanos(0);
4649

@@ -51,12 +54,17 @@ class Dir does Parent {
5154
method children(::?CLASS:D: Bool:D :$refresh = False) {
5255
# XXXX: For now, just fake real caching and be lazy
5356
if $refresh || !$!cache-time {
57+
my $t0 = nano;
58+
5459
$!cache-time = now;
5560

5661
# Directory read may fail due to insufficient permissions
5762
try my @entries = $!path.dir;
5863

5964
@!children = @entries.map({ dir-tree-node($_, parent => self) });
65+
66+
self.debug-elapsed($t0, icon => '💲',
67+
desc => "Refill children for dir {self.short-name.raku}");
6068
}
6169
@!children
6270
}

0 commit comments

Comments
 (0)