You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to #45971. There are 500+ calls to isEqualOrParent and given that the explorer model is already a tree-data-model I understand why...
562 -> at Object.isEqualOrParent (file:///Users/jrieken/Code/vscode/out/vs/base/common/paths.js:298:19)
at Object.isEqualOrParent (file:///Users/jrieken/Code/vscode/out/vs/base/common/resources.js:14:26)
at FileStat.find (file:///Users/jrieken/Code/vscode/out/vs/workbench/parts/files/common/explorerModel.js:280:52)
at Model.findClosest (file:///Users/jrieken/Code/vscode/out/vs/workbench/parts/files/common/explorerModel.js:64:33)
The text was updated successfully, but these errors were encountered:
It seems that FileStat.find is implemented in an expensive way. The FileStat-object seems to keep an array of children and the find-function loops over those, calling isEqualOrParent until it has found a matching child. So, given n-segements of a path with an average of m children the performance is O(nm). That's not good, esp. given that this is called during file-event-avanlanches.
Observations:
to know that a file/folder is contained inside another folder you only need to compare paths until the next path separator
sorting the children array would allow to use binary search and would bring down the runtime to O(log n)
using an index/map that stores FileStat-objects by name (not full path/uri) would bring down the runtime to O(1)
Similar to #45971. There are 500+ calls to isEqualOrParent and given that the explorer model is already a tree-data-model I understand why...
The text was updated successfully, but these errors were encountered: