编程知识 cdmana.com

Qt development of Windows Explorer imitation and small beyond

1、 sketch

Recently, I'm doing something similar to Windows Resource manager software for , First test the file loading process of the resource manager , Learn first, and then do a little transcendence .

The transformation we have done mainly optimizes the following points :

  • Memory optimization processing
  • Sliding optimization processing
  • Big data optimization processing
  • Thumbnail generation optimization processing

After testing, we found that the memory processing in the resource manager is a bit garbage , Its large directory load handling is really garbage . It's garbage because if the machine configuration is not enough, it will directly block the operating system , Memory usage will keep increasing , Here, my own software has been optimized . Let's talk about the data ……

The test system is Win10 The operating system to test , The operating system information tested is as follows

 Insert picture description here

2、 Optimization point

2.1、 Memory processing

2.1.1、Windows Explorer for

2.1.1.1、 Big icon mode

4 10000 pictures , All image loading process takes 500M, Initialization size after loading 200M, All the pictures are loaded and almost take up 1.5 individual G.
 Insert picture description here

2.1.1.2、 Big icon mode

4 10000 pictures , All image loading process takes 500M, Initialization size after loading 100 many M, About half of the image load is almost 5G many , Ordinary computers are not enough for them to play with . This test machine is only 8G Memory , In order to test this, the operating system was jammed several times before , This time it stopped half way through , Occupied 5G The memory , There is no way for other software to survive .
 Insert picture description here

2.1.1.3、 Other modes

Other models have not been tested , If you are interested, you can test it one by one
 Insert picture description here

2.1.2、 use Qt Do similar resource manager software

Is still 4 A catalogue of ten thousand pictures , All image loading process takes 100M Memory , Initialization size after loading 160 many M, Dynamic loading in 160-170M Between .

Optimize : When sliding , Only the images in the display area are loaded with thumbnails and displayed , The loaded thumbnails are released and replaced with default icons . So even if it slides fast or the pulley rolls , Memory is basically unchanged .
 Insert picture description here

2.2、 Slide processing

2.2.1、Windows Explorer for

Load and display in real time . It's OK to say so , Because some pictures can be displayed dynamically , It's not good to say that the slide bar will be stuck , Once the amount of data rises ,Windows When the resource manager does the loading slide, the card will be stuck .

2.2.2、 use Qt Do similar resource manager software

Here I've optimized , Because there's no need to load the thumbnails in real time when swiping quickly . So after the slide is basically stable, we load the thumbnail .

Algorithm optimization : stay X In milliseconds , Continuous execution N Time Y Function time , Only the last function call is executed .

( there gif The reason why the motion picture hesitates to generate is slower than the real effect , Deal with it )
 Insert picture description here

2.3、 Super data processing

I'm talking about mega data here 10w The above data . If you use Windows Its own resource manager , Big icon mode ,4W All the files are loaded ,8G He ran out of memory , Not to mention big data , direct GG. Our response here temporarily applies the page turning method , If you don't consider the memory impact of a single page , The most reasonable one should be 1w Data page , Take up memory if we use our way of processing , It's almost stable at 100M following

2.4、 Thumbnail generation optimization processing

2.4.1、 Video file

Video file ,Windows The video is taken from the first 10s Frame of , Insufficient 10s Take the last frame . In this case , If it's a TV series , This will cause all thumbnails generated by the show to be the same . If you want to distinguish , You can use my method , Take the middle frame of the video . Recommend to use ff, Big video file and small video file to get a few frames of time is roughly the same .

2.4.2、 Music files and picture files

Music and picture thumbnail generation and Windows Agreement . The thumbnail of the music file is hidden in the header of the file , Only a fraction of mp3 Format file contains this information . This and windows Consistent principle , Read first and then generate

版权声明
本文为[osc_l7zl78wt]所创,转载请带上原文链接,感谢

Scroll to Top