parse.com - Weighing Parse Objects - the 128kb Limit -
i want gauge how large parse objects ahead of time. have app lots of addunique , i'd have idea of how capacity addunique single parse object. i'd make sure don't bump or exceed limit.
this might of help. answer stack overflow question , appears address question. there lot of comments , info may in post well.
function roughsizeofobject( object ) { var objectlist = []; var stack = [ object ]; var bytes = 0; while ( stack.length ) { var value = stack.pop(); if ( typeof value === 'boolean' ) { bytes += 4; } else if ( typeof value === 'string' ) { bytes += value.length * 2; } else if ( typeof value === 'number' ) { bytes += 8; } else if ( typeof value === 'object' && objectlist.indexof( value ) === -1 ) { objectlist.push( value ); for( var in value ) { stack.push( value[ ] ); } } } return bytes; }
Comments
Post a Comment