Browse Source

bulkdata: Build up rows and write to disk all at once

tags/nilmdb-1.2.3
Jim Paris 9 years ago
parent
commit
c512631184
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      nilmdb/server/bulkdata.py

+ 3
- 1
nilmdb/server/bulkdata.py View File

@@ -221,9 +221,11 @@ class File(object):
# An optimized verison of append, to avoid flushing the file
# and resizing the mmap after each data point.
try:
rows = []
for i in xrange(count):
row = dataiter.next()
self._f.write(packer(*row))
rows.append(packer(*row))
self._f.write("".join(rows))
finally:
self._f.flush()
self.size = self._f.tell()


Loading…
Cancel
Save