[#LIB-75] Make calculation of encoded item length lazy