Files
test/source
Aras Pranckevicius 9962c50b54 BLI: factor out BLI_path_has_hidden_component, fix it and speed it up
Factors out utility function "does the path contain any hidden file/folder
components?" function out of innards of UI code (edit_file,
is_hidden_dot_filename) into a BLI function BLI_path_has_hidden_component
and then:
- Adds unit test coverage to it, which uncovered some inconsistencies
- Fix the behavior inconsistencies:
  - A path component that is just a dot (.), was not considered hidden.
    Unless it was the first folder component (now this is fixed).
  - A path component that ended in a tilde (~) was considered hidden.
    Unless it was the first folder component (now this is fixed).
- Speedup the function by not doing several recursive scans over the
  string; instead all the logic is done in a single string scan.

Synthetic HasHiddenComponents_Performance test: 6.0s -> 1.1s for 50M calls
on Mac M1 Max.

More real world test (setup as in #120494): out of whole build_catalog_tree
time, the time taken by BLI_path_has_hidden_component drops from 37% down
to 28%

Pull Request: https://projects.blender.org/blender/blender/pulls/120541
2024-04-16 16:51:31 +02:00
..