I want to gauge how large my Parse Objects are ahead of time. I have an app that will do lots of addUnique and I'd like to have an idea of how much capacity this is to addUnique to a single Parse Object. I'd like to make sure that I don't bump into or exceed that limit.
            Asked
            
        
        
            Active
            
        
            Viewed 222 times
        
    0
            
            
        - 
                    What programming language are you using? – jimrice Mar 28 '15 at 21:43
- 
                    Javascript. Everything in Parse is JSON objects I think. – rashadb Mar 29 '15 at 05:21
1 Answers
1
            This might be of help. It is an answer from another stack overflow question and appears to address your question. There are a lot of comments and info that may help in the post as 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 i in value ) {
                stack.push( value[ i ] );
            }
        }
    }
    return bytes;
}
 
     
    