title: Reading Images As JPEG VS Raw Data
body: <p>I am developing a Python program where speed is critical, and one of its core components is reading JPEG natural images, with resolutions between 128 X 128 and 512 X 512, from disk. Currently, I utilize jpeg4py, a libjpeg-turbo-based library that is, in my experience, faster than its competitors (e.g., PIL or OpenCV). However, according to a few preliminary experiments I conducted, by saving those images' array representations as pure raw data in binary format, the reading speed is accelerated by roughly 25% (the dataset's storage size ends up enlarging by nearly an order of magnitude, but that is not an issue for my application.).</p>
  <p>Previously, I assumed the overhead introduced by JPEG's decoding scheme is made up for by the fact that the files being loaded are smaller and thus fewer bytes are read, but it appears I was wrong? Perhaps my findings would vary on different hardware? In that case, what would the maximal gap between the two methods be, e.g., is it circa 30%, or are more dramatic figures, such as 200%, possible?</p>
  <p>Please note that the chief metric important to my usage is reading speed, and other considerations are secondary. Also, if there are faster alternatives for achieving my goal, I would very much appreciate it if you could mention them.</p>
  <p>Thank you.</p>