I created a JSFiddle to find out how much data I can insert into my browser.
Link http://jsfiddle.net/GWxAk/
The code is simple. It just tries to insert as many rows into the array as possible. Lines have an approximate length of 300-310 characters.
My question is: does the result depend on how much memory I have on my PC? Is the browser really different from the browser?
For example, if I have 8 GB of RAM, will I get much more if I have 4 GB?
var s = '';
for (var i = 0; i < 300; i++) {
s += 'a';
}
array = [];
count = 0;
function doMore() {
for (var i = 0; i < 1000; i++) {
count++;
array.push(s + count);
}
};
function repeat() {
doMore();
document.body.innerHTML = 'size:' + array.length;
setTimeout(repeat, 100);
}
repeat();
In my case, chrome hangs on 14850000, and I have 4gb RAM. This is an array of almost 15 million items. Not bad, I think.
Do you guys get the same thing? Can someone tell me how to give the browser as much memory as possible.
thank