JavaScript - object sizes

Warning: a potentially stupid question, purely out of curiosity.

If, for example, I make an AJAX request and return an array of 1000 objects like this:

{
    MinimumDistance: ...,
    MaximumDistance: ...,
    MinimumTime: ...,
    MaximumTime: ...,
    ReallyLongButDescriptivePropertyName: ...
} 

      

Would this consume more memory than if I shortened the member names (like MinDist)?

If so, is there anything I do to reduce the memory footprint of these objects rather than shorten the member names?

Thank.

+3


source to share


1 answer


Using longer properties may end up with a longer one (which means it takes more bytes and therefore more time and time to reach the client). But usually the answer is gzipped

, and so the overhead is minimal compared to the usefulness of getting friendly property names.
Returning object 1.000 is not good practice anyway, you should place them on pages and keep your response as small as possible, especially considering that mobile phones have less bandwidth.



0


source







All Articles