microsoft / Windows-Dev-Performance

A repo for developers on Windows to file issues that impede their productivity, efficiency, and efficacy
MIT License
438 stars 21 forks source link

File Explorer very slow when there are a lot of media files. #20

Open FirehawkV21 opened 4 years ago

FirehawkV21 commented 4 years ago

Environment

Item Value
OS, Version / Build Windows 10, Version 10.0.14092.0 (Insider Build)
Processor Architecture x64
Processor Type & Model Intel Core i3-6006U
Memory 16GB
Storage Type, free / capacity (e.g. C: SSD 128GB / 512GB) C: SSD 37.4GB/111GB
Relevant apps installed VS Code, Visual Studio

Description

When I'm working on a folder with a lot of media files (say, music for a game I'm developing), the File Explorer would take a long time to process the metadata. If the files are on an SSD, it's manageable but if it's on a slow drive (especially if it's a secondary drive and the chipset lets the drive to enter sleep mode) it can take a lot of minutes.

This only happens if the folder's view is set to "Details" and the metadata tabs are visible. If the folder has a lot of general files (scripts, for example), it will load in normally.

Steps to reproduce

  1. Put a file with a lot of media files in a drive (preferably, not the main one).
  2. Make sure that the view is set to "Detailed" and you have a few tabs that are related to the metadata of the files (Title. Artist, etc.).
  3. Open the folder.

Bonus:

Expected behavior

The explorer would show all files. After a few seconds, it would show the metadata for all files.

Actual behavior

File Explorer takes a long time to load files. Sometimes, it does this: image Or the window hangs.

asklar commented 4 years ago

@acemod Normally, file explorer will only try to gather information about the items that are currently visible and pre-fetch some more in case you want to scroll in either direction, so having a large number of files shouldn't affect performance too much. However, the shell is extensible by 3rd parties, and one often finds that these extensions can end up slowing down the UI. It would be good to know what kind of shell extensions you have installed in order to narrow down the culprit. My guess is that one of the codecs you might have installed is trying to extract information from a file on the UI thread and is taking a long time. There are 3rd party apps such as shellexview that you could use to try to narrow down what might be causing this issue.

FirehawkV21 commented 4 years ago

Well... the only codec I had installed is Xiph.org's Codecs installed (not counting the codecs that are on the Microsoft Store). I removed and it didn't do anything. I'm going to check the other extensions I have installed. Looking at the list in Shellxview, I don't see anything that could affect media files in File Explorer. I'll attach the list of extensions I have, just in case. 3rdpartyextensions.txt

Side-note: I wonder if it's possible to move the fetching data to a background thread. Granted, it could break some extensions, but that could alleviate the issue by a lot. I didn't make any shell extensions myself, but it could be a good idea.

sylveon commented 4 years ago

I'm having a similar issue with a ~400-file folder (it's the folder where I dump my gameplay recordings). It's a mix of H.264 media files, H.265 media files, and a couple of PNGs (the last from accidentally hitting ReLive's screenshot hotkey while playing games). It's about 65gb of media files in total.

Loading it takes a long time (around 2 minutes), which is very impractical if I want to quickly share something from here.

This is a video of the folder loading: https://yiff.forsale/GiganticBowedEmboar.mp4

The folder where I store my Steam screenshots has this problem, but less pronounced: https://imgur.com/tlQaEmI

The only third party shell extensions I have are IconViewer, TC4Shell and the Radeon Software shell extension, none of which should have anything to do with media previews: image

I installed no third party codecs.

asklar commented 4 years ago

@sylveon shell extensions can negatively affect performance for files other than the ones they purport to add functionality to, so one thing would be to disable all those temporarily and see if load times improve. The main thing though is I noticed those folders are not the usual user videos/pictures folders, so they aren't indexed by default. Can you turn on Indexing for these folders and let things run for a bit until they get indexed and report back? you should see improved load times that way.

sylveon commented 4 years ago

Adding them to the system index did not help unfortunately.

FirehawkV21 commented 4 years ago

So... I turned off all of the shell extensions that were third party and it didn't improve the load times at all. Indexing did improve the load times on me. I do wish there was a better way to load anything that isn't indexed. Especially since the hard drive (in my current laptop) is connected to the SATA slot that was the DVD drive before. True, HDDs aren't as demanding as SSDs in bandwidth but combined with the power settings (since the hard drive can also go to sleep mode or turn itself off) the delay may fluctuate.

calculuschild commented 1 year ago

I am experiencing this as well with my folders full of recorded video. No shell extensions that I am aware of.

StevenWooding commented 1 year ago

It's a feature that analyzes the folder and try to find out which view mode is best to view the current folder. You can't disable it from what I could google. So I installed another explorer called explorer++. And it works very well since it's very very fast and it looks like the normal windows explorer, so there isn't much of a learning curve. It's also open source so you can feel safe that there isn't any malicious code inside it. You can download it on explorerplusplus.com

calculuschild commented 1 year ago

Thanks for the tip!

It's a feature that analyzes the folder and try to find out which view mode is best to view the current folder.

Perhaps the display mode could be cached instead of re-analyzing every single time the folder is opened? (And why does it take 2+ minutes to see that 100/100 files in the folder are .MP4 or whatever? That should be instantaneous.)

StevenWooding commented 1 year ago

I agree. The caching of the view would be ideal! But I don't think it's on the top of the list of todo's in Microsoft list of fixes. Especially that they are now throwing all their resources at AI development. So until then we might need to find another solution.

jrm523 commented 8 months ago

How is this still an issue three years later? Microsoft! What is going on?

sunny127 commented 6 months ago

I found the solution for the problem here: https://www.youtube.com/watch?v=t2eN3kq2Dm8

calculuschild commented 6 months ago

I found the solution for the problem here: https://www.youtube.com/watch?v=t2eN3kq2Dm8

Can confirm this works. In the folder, Right Click -> Properties -> Customize -> Optimize this folder for: "General Items".

The youtube video comments that his video folder takes ages to open "because it's trying to calculate the lengths of all the videos". If that is the true cause, seems like that should be something that can be sped up or cached at least.

rafalfitt commented 6 months ago

I found the solution for the problem here: https://www.youtube.com/watch?v=t2eN3kq2Dm8

Can confirm this works. In the folder, Right Click -> Properties -> Customize -> Optimize this folder for: "General Items".

Sorry: this is a workaround, not the proper solution.

dermoth commented 6 months ago

UPDATE: See my next comment

~I noticed the same thing, it takes a while even with just about a hundred files. One useful distinction though: I noticed it on my Captures folder where I was recording video using the xbox game bar, but only after conversion to HEVC. My script keeps the originals in a different folder in case I need them, so:~

~Originals folder: >80 files, all H.264, on open and refresh listing displays instantly and timestamps appear asynchronously on visible items only.~

~Captures folder: \~115 files, all HEVC (H.265), on open and refresh listing remains blank for about 10-15 seconds (with only the "Working on it..." message), then files shows up with all their timestamps pre-loaded.~

~There is clearly an issue where Explorer processes HEVC files differently, in a non-asynchronous way. This is a work computer and I keep a thigh control on installed 3rd party software, and avoid in particular anything that adds 3rd party shell extensions.~

dermoth commented 6 months ago

Actually scratch my last comment. I renamed the Captures folder to Captures-old, still inside Videos,and file info started loading asynchronously and it was back to being very fast. It's the same for subdirectories created inside Captures.

Then I recreated a new Captures folder and moved the videos back there, the old behavior returned.

IT appears to be tied to the path, not even the folder settings,and I could not see any different settings between the two folders in Explorer settings... I'm looking into the registry now but my hopes are slim.

aymen157 commented 1 month ago

Actually scratch my last comment. I renamed the Captures folder to Captures-old, still inside Videos,and file info started loading asynchronously and it was back to being very fast. It's the same for subdirectories created inside Captures.

Then I recreated a new Captures folder and moved the videos back there, the old behavior returned.

IT appears to be tied to the path, not even the folder settings,and I could not see any different settings between the two folders in Explorer settings... I'm looking into the registry now but my hopes are slim.

This is the case for me too.. Weird. Slowness seems to be tied to the folder path name. Did you find a solution ?

AdamBraden commented 1 month ago

Regarding the general perf of File Explorer with a lot of video content, double check if the folder is sorted by Length. Normally Length should fill in asynchronously, however when sorted by length, then FE needs to get this data causing a lot of I/O and delaying FE from refreshing the list.

As for 'Videos\Captures' folder, generally any new folder created under Videos defaults to a folder type of Video, not General Items.

dermoth commented 1 month ago

Hey, sorry I thought I had replied already - it turned out that indeed I was sorting by date, and rather that using the file's date Explorer was using the date from MPEG metadata. Since it appears to be the same field this is not super intuitive, nor there appear to be a way to disable that behavior.

For Captures this is particularly annoying, all captures are done on the computer so the file and metadata dates are both as accurate, but I can't sort by date if I have lots of files.