Commit 2965d2e
committed
perf: cache resolved indexed directories to avoid repeated resolution
Made the `dirs` variable in `defaultIndexedDirectory()` static const so
that `getResolvedIndexedDirectories()` is only called once. This avoids
redundant directory resolution on every invocation of the default indexed
directory lookup.
将`defaultIndexedDirectory()`中的`dirs`变量声明为static const,
使`getResolvedIndexedDirectories()`仅被调用一次,避免每次查找默认
索引目录时重复进行目录解析。
Log: 缓存已解析的索引目录避免重复解析
PMS: https://pms.uniontech.com/bug-view-361809.html
Influence: 减少重复调用时的冗余文件系统操作,提升频繁查询默认索引目录的搜索场景性能。需确认应用重启后仍能正确加载索引目录配置变更,以及静态初始化不存在线程安全问题。1 parent 27fe7a5 commit 2965d2e
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
| 517 | + | |
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | | - | |
| 618 | + | |
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| |||
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
717 | | - | |
| 717 | + | |
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
721 | | - | |
| 721 | + | |
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
| |||
0 commit comments