test_performance.py
760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
__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
"""