test_performance.py 760 Bytes
__author__ = 'chunk'

import os,sys
from PIL import Image
from ..common import *

def bench_filereading():
    timer = Timer()
    timer.mark()
    for path, subdirs, files in os.walk('/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val/Train_5000'):
            for name in files:
                imagepath = os.path.join(path, name)
                # print imagepath
                img = Image.open(imagepath)
                img.save(os.path.join('/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val/tmp', name), format='JPEG')
    timer.report()

    """
    performance:
    1000(131832 B):
        read-write: 13.414876s
    2000(270908 B):
        read-write: 25.270484s
    5000(664204 B):
        read-write: 64.528306s

    About 10MB/s
    """