Skip to content

Commit 2cf57c6

Browse files
authored
perf: Remove unused field __cache_children (#509)
Together with __owner, this led to O(n^2) space where n is the number of nodes in directory, and yet it was not used anywhere.
1 parent 43efd32 commit 2cf57c6

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

autoload/fern/internal/node.vim

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,6 @@ function! fern#internal#node#children(node, provider, token, ...) abort
8282
\}, a:0 ? a:1 : {})
8383
if a:node.status is# s:STATUS_NONE
8484
return s:Promise.reject('leaf node does not have children')
85-
elseif has_key(a:node.concealed, '__cache_children') && options.cache
86-
" Return a fresh copy of cached children so that status won't be cached
87-
return s:AsyncLambda.map(
88-
\ a:node.concealed.__cache_children,
89-
\ { v -> deepcopy(v) },
90-
\)
9185
elseif has_key(a:node.concealed, '__promise_children')
9286
return a:node.concealed.__promise_children
9387
endif
@@ -102,7 +96,6 @@ function! fern#internal#node#children(node, provider, token, ...) abort
10296
\ '__owner': a:node,
10397
\ })
10498
\ }))
105-
\.then({ v -> s:Lambda.pass(v, s:Lambda.let(a:node.concealed, '__cache_children', v)) })
10699
\.finally({ -> Done() })
107100
\.finally({ -> Profile() })
108101
let a:node.concealed.__promise_children = p
@@ -199,7 +192,6 @@ function! fern#internal#node#collapse(node, nodes, provider, comparator, token)
199192
\.finally({ -> Done() })
200193
\.finally({ -> Profile() })
201194
call p.then({ -> s:Lambda.let(a:node, 'status', s:STATUS_COLLAPSED) })
202-
\.then({ -> s:Lambda.unlet(a:node.concealed, '__cache_children') })
203195
let a:node.concealed.__promise_collapse = p
204196
\.finally({ -> s:Lambda.unlet(a:node.concealed, '__promise_collapse') })
205197
return p

0 commit comments

Comments
 (0)