[MLDB-1303] implemented PR suggestion to calculating the size twice.
[MLDB-1303] implemented PR suggestion to calculating the size twice.

mldbai/mldb,mldbai/mldb,mldbai/mldb,mldbai/mldb,mldbai/mldb,mldbai/mldb,mldbai/mldb