|
1 | 1 | """Performance data streaming performance""" |
2 | | - |
3 | 2 | from lib import TestBigRepoR |
4 | 3 | from gitdb.db import * |
5 | 4 | from gitdb.stream import * |
@@ -53,7 +52,7 @@ def __init__(self, *args): |
53 | 52 |
|
54 | 53 | class TestObjDBPerformance(TestBigRepoR): |
55 | 54 |
|
56 | | - large_data_size_bytes = 1000*1000*10 # some MiB should do it |
| 55 | + large_data_size_bytes = 1000*1000*50 # some MiB should do it |
57 | 56 | moderate_data_size_bytes = 1000*1000*1 # just 1 MiB |
58 | 57 |
|
59 | 58 | @with_rw_directory |
@@ -147,33 +146,39 @@ def istream_iter(): |
147 | 146 |
|
148 | 147 | print >> sys.stderr, "Threads(%i): Compressed %i KiB of data in loose odb in %f s ( %f Write KiB / s)" % (pool.size(), total_kib, elapsed, total_kib / elapsed) |
149 | 148 |
|
150 | | - |
151 | 149 | # decompress multiple at once, by reading them |
| 150 | + # chunk size is not important as the stream will not really be decompressed |
| 151 | + |
| 152 | + # until its read |
152 | 153 | istream_reader = IteratorReader(iter([ i.sha for i in istreams ])) |
153 | 154 | ostream_reader = ldb.stream_async(istream_reader) |
154 | 155 |
|
155 | 156 | chunk_task = TestStreamReader(ostream_reader, "chunker", None) |
156 | 157 | output_reader = pool.add_task(chunk_task) |
| 158 | + output_reader.task().max_chunksize = 1 |
157 | 159 |
|
158 | 160 | st = time() |
159 | 161 | assert len(output_reader.read(nsios)) == nsios |
160 | 162 | elapsed = time() - st |
161 | 163 |
|
162 | | - print >> sys.stderr, "Threads(%i): Decompressed %i KiB of data in loose odb in %f s ( %f Write KiB / s)" % (pool.size(), total_kib, elapsed, total_kib / elapsed) |
| 164 | + print >> sys.stderr, "Threads(%i): Decompressed %i KiB of data in loose odb in %f s ( %f Read KiB / s)" % (pool.size(), total_kib, elapsed, total_kib / elapsed) |
163 | 165 |
|
164 | 166 | # store the files, and read them back. For the reading, we use a task |
165 | 167 | # as well which is chunked into one item per task. Reading all will |
166 | 168 | # very quickly result in two threads handling two bytestreams of |
167 | 169 | # chained compression/decompression streams |
168 | 170 | reader = IteratorReader(istream_iter()) |
169 | 171 | istream_reader = ldb.store_async(reader) |
| 172 | + istream_reader.task().max_chunksize = 1 |
170 | 173 |
|
171 | 174 | istream_to_sha = lambda items: [ i.sha for i in items ] |
172 | 175 | istream_reader.set_post_cb(istream_to_sha) |
173 | 176 |
|
174 | 177 | ostream_reader = ldb.stream_async(istream_reader) |
| 178 | + |
175 | 179 | chunk_task = TestStreamReader(ostream_reader, "chunker", None) |
176 | 180 | output_reader = pool.add_task(chunk_task) |
| 181 | + output_reader.max_chunksize = 1 |
177 | 182 |
|
178 | 183 | st = time() |
179 | 184 | assert len(output_reader.read(nsios)) == nsios |
|
0 commit comments