Skip to content

Commit

Permalink
optimize logging in the inner loop during compression too
Browse files Browse the repository at this point in the history
  • Loading branch information
esc committed Jun 29, 2014
1 parent 574efcc commit 0854930
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bloscpack/abstract_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@ def pack(source, sink,
compress_func = source.compress_func
# read-compress-write loop
for i, chunk in enumerate(source):
log.debug("Handle chunk '%d'%s" %
(i, ' (last)' if i == nchunks - 1 else ''))
if log.LEVEL == log.DEBUG:
log.debug("Handle chunk '%d'%s" %
(i, ' (last)' if i == nchunks - 1 else ''))
compressed = compress_func(chunk, blosc_args)
sink.put(i, compressed)
log.debug("chunk handled, in: %s out: %s" %
(double_pretty_size(len(chunk)),
double_pretty_size(len(compressed))))
if log.LEVEL == log.DEBUG:
log.debug("chunk handled, in: %s out: %s" %
(double_pretty_size(len(chunk)),
double_pretty_size(len(compressed))))
sink.finalize()


Expand Down

0 comments on commit 0854930

Please sign in to comment.