Skip to content

Speedup creation of FileTrees #84

@ghyatzo

Description

@ghyatzo

Hello,

I have quite a bit of files (~400k) and wanted to see how FileTree handled them. Unfortunately, trying to create the FileTree takes forever.
Interrupting the execution shows that most of the time is spent inside the stat function.

On my machine and for a file in that directory @time stat(file) takes approximately 0.005 seconds (it's not on the same machine). A back of the napkin calculation shows that building up the FileTree would then take roughly ~2000 seconds. Which seems a tad too much to even begin starting the work?

In contrast, a simple readdir(directory) takes a couple of seconds, would it be possible to also construct a FileTree in a "lazy" way without needing to stat every file and simply work with simple paths at first?

Thanks!

EDIT: Ok I jumped my guns a little bit, I tried to just wait and see how long it would take just for science. It took ~18-20 minutes.
I did use @time to try and get a better estimate, but I unfortunately forgot to put a ; at the end, so had to interrupt the printing (see #83). It's a bit better than what I feared, but it's still not as fast as I would have hoped seeing the performance of readdir.

PS: This package is very elegant, amazing job!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions