Speeding up file system access?

前端 未结 5 2140
盖世英雄少女心
盖世英雄少女心 2021-02-14 08:38

My app scans part of a file system, and my users reported it was very slow when they were scanning a network drive. Testing my code, I identified the bottleneck: the methods

5条回答
  •  有刺的猬
    2021-02-14 09:10

    How are you building this file list? Unless you are displaying every file on the system at the same time, you should have some options...

    1. Only process this information when the user asks for it. e.g. They click on folder "Windows", at which time you could process the files within Windows.
    2. Process this information in a background thread, giving the illusion of better response time.

    Perhaps if you show the code you are using to build the list, we could find some other areas of improvement. (Why can't you just infer the type based on the method used to gather the information? If you're calling a method like GetFiles() don't you already know that everything returned is a file?)

提交回复
热议问题