Skip to content

O(n^2) CPU performance in explorer with many images on the desktop #80

@randomascii

Description

@randomascii

Environment

Item Value
OS, Version / Build Win32NT 10.0.19041.0 Microsoft Windows NT 10.0.19041.0
Processor Architecture AMD64
Processor Type & Model Intel Core i7-7820HQ @ 2.90 GHz
Memory 32 GB
Storage Type, free / capacity (e.g. C: SSD 128GB / 512GB) SSD, 32GB / 254 GB
Relevant apps installed Python

Description

If you have many files on your desktop then explorer occasionally goes off and rearranges icons. During this time it doesn't pump messages from one of its UI threads. This has, on some customer's machines, led to UI hangs of various types. Even without the UI hangs this is excessively inefficient.

Steps to reproduce

src = r'path_to_a_jpg_file.jpg'
for i in range(1000):
shutil.copy(src, r'c:\users\bruce\Desktop\tst%04d.jpg' % i)

That is, put a thousand files on your desktop. I tested with .jpg files but I think any images will do and probably other file types as well. Then, unplug or plug in an external monitor.

Expected behavior

Explorer should rearrange the icons so that the conform to the new desktop layout and it should do this in no more than half a second.

Actual behavior

Explorer.exe consumes 100% of a core for about two minutes. During this time that thread is not pumping messages - WPA reports it as a 110 s MsgCheck Delay in UI Delays and I think the only reason it was reported as being that short a delay was because I stopped tracing before the work was finished.

This happens even when the desktop is set to hide the icons.

Original report was here:
https://twitter.com/FreyaHolmer/status/1355971680406007810

Some twitter discussion is here:
https://twitter.com/BruceDawson0xB/status/1359784745777786882

The same issue was previously reported here:
https://qiita.com/okuoku/items/e344a81fd6494a19bb26

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions