MaMu
MaMu

Reputation: 1869

Jquery and memory

I'm considering a possibility of doing some computation by jquery only. I would need to save few huge hashes in memory.

I wonder how much memory is allocated for one hash, which contains double value and a date and has 7k entries?

Upvotes: 1

Views: 78

Answers (2)

pax162
pax162

Reputation: 4735

Here's a rough estimate, with chrome heap snapshot (fiddle used: http://jsfiddle.net/Hukps/3/) First snapshot is without any data, then snapshots increase by 7000 records.

enter image description here

So I would say something like 0.6-0.7 MB.

fiddle code:

window.data = [];
$(go).click(function(){
    var count = 7000;

    for (var i = 0; i< count ; i++)
    {
        window.data.push({
            d:9007199254740992,
            dt: new Date()
        });
    }
    console.log(window.data.length);
});

Upvotes: 2

Ethan
Ethan

Reputation: 2784

  1. You probably don't need jQuery
  2. Use JSPERF to test which is faster
  3. Use your browser's debugging/js tools to profile the memory usage (Here is how to do it in Chrome)
  4. You probably don't need jQuery

Upvotes: 2

Related Questions