What influences running time of reading a bunch of images?
        Posted  
        
            by 
                remi
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by remi
        
        
        
        Published on 2014-06-10T15:21:42Z
        Indexed on 
            2014/06/10
            15:24 UTC
        
        
        Read the original article
        Hit count: 225
        
I have a program where I read a handful of tiny images (50000 images of size 32x32).
I read them using OpenCV imread function, in a program like this:
std::vector<std::string> imageList; // is initialized with full path to the 50K images
for(string s : imageList) {
  cv::Mat m = cv::imread(s);
}
- Sometimes, it will read the images in a few seconds.
 - Sometimes, it takes a few minutes to do so.
 - I run this program in GDB, with a breakpoint further away than the loop for reading images so it's not because I'm stuck in a breakpoint.
 - The same "erratic" behaviour happens when I run the program out of GDB.
 - The same "erratic" behaviour happens with program compiled with/without optimisation
 - The same "erratic" behaviour happens while I have or not other programs running in background
 - The images are always at the same place in the hard drive of my machine.
 - I run the program on a Linux Suse distrib, compiled with gcc.
 
So I am wondering what could affect the time of reading the images that much?
© Stack Overflow or respective owner