Papa Parse appears to be causing Chrome and Opera to crash (Windows 7) if I attempt to parse "large" csv strings of about 1 million rows with about 20 columns. Where the same page successfully loads in Firefox. Chrome and Opera crash even before calling Parse if I have a large csv string defined and include a <script> tag to the papaparse.js library. If I don't include the <script> tag for papaparse.js there are no problems creating large csv strings but then I can't parse them. In my actual use case, I am not generating the large csv strings in javascript but rather pulling them out of a zip archive. Doesn't appear to make any difference if I use the step or chunk functions. You can run the test case here; Test Case Problem code;
<!doctype html>
<html>
<script src="http://papaparse.com/resources/js/papaparse.js"></script>
<body>
<script>
function my_createMockCSV(rows) {
var my_csv="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v\r\n";
for (var i=1; i<rows; i++) {
my_csv+= i+","+ i+","+ i+","+ i+","+ i+","+ i+","+ i+","+ i+","+
i+","+ i+","+ i+","+ i+","+ i+","+ i+","+ i+","+ i+","+
i+","+ i+","+ i+","+ i+","+ i+","+ i+","+"\r\n";
}
return my_csv;
}
function parseCSV(csv) {
var rowcount=0;
Papa.parse(csv,
{
delimiter: ',',
worker: false,
encoding: 'default',
header: true,
chunk: function(results) {
rowcount+= results.data.length;
console.log("Parsed rows: "+rowcount);
},
complete: function (results) {
console.log("Complete - parsed: "+rowcount+" rows");
}
});
}
function run_testcase() {
rows=document.getElementById("rows").value;
//parseCSV(my_createMockCSV(rows));
console.log("Begin Generating CSV ...");
alert("About to generate Mock CSV");
var my_csv=my_createMockCSV(rows);
console.log("End Generating CSV ...");
alert("About to parse Mock CSV");
parseCSV(my_csv);
}
</script>
Papaparse test case script: Will crash Chrome, Opera<br/>
Rows: <input id="rows" type="number" value="1000000"> (Try around 1mil rows)
<button onclick="run_testcase();">Run</button>
</body>
</html>