You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/09/22 21:01:40 UTC
[GitHub] janl commented on a change in pull request #835: Avoid decompressing just to calculate external size
janl commented on a change in pull request #835: Avoid decompressing just to calculate external size
URL: https://github.com/apache/couchdb/pull/835#discussion_r140595880
##########
File path: src/couch/src/couch_db_updater.erl
##########
@@ -1079,14 +1079,13 @@ copy_docs(Db, #db{fd = DestFd} = NewDb, MixedInfos, Retry) ->
{Body, AttInfos} = copy_doc_attachments(Db, Sp, DestFd),
% In the future, we should figure out how to do this for
% upgrade purposes.
- EJsonBody = case is_binary(Body) of
+ ExternalSize = case is_binary(Body) of
true ->
- couch_compress:decompress(Body);
+ couch_compress:uncompressed_size(Body);
false ->
- Body
+ ?term_size(Body)
Review comment:
If you move `?term_size()` into [`couch_compress:uncompressed_size()`](https://github.com/apache/couchdb/pull/835/files#diff-6991b69feab44252db52c58fff0f1812R97), then you can get rid of the `case` and make this `ExternalSize = couch_compress:uncompressed_size(Body),` (at least in my limited testing, you may be covering for cases I haven?t seen)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services