dokan-dev / dokan-dotnet

Dokan DotNet Wrapper
http://dokan-dev.github.io
MIT License
462 stars 116 forks source link

Low performance for .pptx files on load. #308

Closed TatevAbgaryan closed 2 years ago

TatevAbgaryan commented 2 years ago

I'm trying to migrate from CBFS to Dokan in my project.

It's seems to go quiet smoothly, but after some testing I've noticed that file info for .pptx files is getting loaded too slowly. I've checked it on the sample also, it is a bit faster but still noticeably longer.

Any ideas how I can fix this?

Liryna commented 2 years ago

Have you tried with the native memfs sample ? Is that also slow ? It would help to see if it is the dotnet wrapper that is slowing the reads See https://github.com/dokan-dev/dokan-dotnet/issues/300#issuecomment-1066085481

Also worth noting that Powerpoint is doing a lot of very small reads by counting on the filesystem to do a large read and cache the results so it can quickly serve the small reads after. See https://github.com/dokan-dev/dokany/discussions/1047

TatevAbgaryan commented 2 years ago

@Liryna Thank you for your quick reply. I have tried UnsafeMirror in the sample and now we are getting whole files list after 1-2 seconds. As I am using encrypted storage in my project it takes still longer, so I would like to know if there is a way do not read file contents while listing files. I think that would probably solve my problem.

Liryna commented 2 years ago

Unfortunately that's not under our control. It is explorer they is doing it for thumbnails. Maybe network mount could make explorer more kind ?

TatevAbgaryan commented 2 years ago

@Liryna I think network drive would not be acceptable in my case. Maybe there is a way to know if read file function is called after double click on file or not ?

Liryna commented 2 years ago

The filesystem does not have the knowledge of what produced explorer to read the files. Maybe there is a type of explorer extension that could help?

LTRData commented 2 years ago

I think you could solve this by modifying the file enumeration routine to return some file attributes for files that should not be opened by Explorer as part of directory enumeration. I think that FileAttributes.Offline and/or FileAttributes.NotContentIndexed should be enough. The exact behavior of Explorer in response to these attributes have varied a bit across versions though but I guess it could still be worth testing in your case.

TatevAbgaryan commented 2 years ago

I have tried to set file attribute to FileAttributes.Offline and it works very fast, but now on files I can see grey cross icon. Do you know if there is a way do not display this cross icon?

LTRData commented 2 years ago

I don't think that is possible without an Explorer extension. At least I cannot think of another way to change that behaviour, particularly not from file system side.

TatevAbgaryan commented 2 years ago

I see. Then I'm going to choose between showing icons with cross or loading file info for .pptx files with a little bit of latency. Thank you for your kind support!