UweKeim / ZetaLongPaths

A .NET library to access files and directories with more than 260 characters length.
https://nuget.org/packages/ZetaLongPaths
MIT License
142 stars 28 forks source link

Poor performance for GetDirectories/GetFiles #28

Closed taori closed 4 years ago

taori commented 4 years ago

I am using this package in my project at https://github.com/taori/VolumeScanner2/tree/bugfix/performanceoptimization

However after a lot of Performance optimization i came to a point where the hot path are the two methods in the title - Do you think there is any way those methods could be sped up anymore or is it just slow by nature of things?

on a m2ssd scanning 150gb recursively takes 27 seconds. Does that seem reasonable or is there room for more performance?

UweKeim commented 4 years ago

Just a wild guess:

Probably it would be good to not get the whole thing into memory but use something like Directory.EnumerateFiles which iterates file-by-file.

If you would like to contribute to the library, just submit a pull request.

taori commented 4 years ago

Just a wild guess:

Probably it would be good to not get the whole thing into memory but use something like Directory.EnumerateFiles which iterates file-by-file.

If you would like to contribute to the library, just submit a pull request.

okay. I'll build from source and have a look which paths are hot. i sure hope it isn't some pinvoke method, because then there would be no way to optimize i guess

taori commented 4 years ago

Hm. I can't reference the project because it won't compile because it won't redownload the Microsoft.Net.Compilers.Toolset package - which version of VS are you using?

taori commented 4 years ago

Doesnt look like this can be fixed without substantial effort.

grafik

At least not without substentially refactoring the underlying call hierarchy.

UweKeim commented 4 years ago

Maybe use some if/else to check whether a path is a long/short path and fall back to the .net Framework functions for these cases? (Assuming that those are faster)