-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy paththroughput_stats.py
More file actions
29 lines (24 loc) · 962 Bytes
/
throughput_stats.py
File metadata and controls
29 lines (24 loc) · 962 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
"""Test how fast we can read and write."""
import logging
import time
from ecoshard import geoprocessing
logging.basicConfig(
level=logging.DEBUG,
format=(
'%(asctime)s (%(relativeCreated)d) %(levelname)s %(name)s'
' [%(pathname)s.%(funcName)s:%(lineno)d] %(message)s'))
LOGGER = logging.getLogger(__name__)
if __name__ == "__main__":
path = r"C:\Users\richp\Downloads\impact_obs_10m_2017_compressed_md5_99376e.tif"
for exp in reversed(range(20, 31)):
start_time = time.time()
largest_block = 2**exp
for _ in geoprocessing.iterblocks(
(path, 1), offset_only=True, largest_block=largest_block):
pass
print(f'offset,{time.time()-start_time:.2f},{exp}')
start_time = time.time()
for _ in geoprocessing.iterblocks(
(path, 1), largest_block=largest_block):
pass
print(f'iterblocks,{time.time()-start_time:.2f},{exp}')