I am working on client side scripts and need to do heavy computations like pushing huge number of objects in an array, it causes JavaScript to stop response and browser hangs giving an alert:

Is there any best practices or design patterns for handling these computation, I search and find many different ways to handle these situation but solutions are difficult to implement so I need best practices and easy to understand?
(I am writing code just for example But I need a general solution that is cross-browser i.e, multi-threading etc)
Example Code (series contains thousands of objects):
for (var series = 0; series < chartObj.masterChart.series.length; series++) {
var detailData = [];
jQuery.each(chartObj.masterChart.series[series].data, function (i, point) {
if (point.x >= chartObj.RangeSelectedMinValue && point.x <= chartObj.RangeSelectedMaxValue) {
detailData.push({
x: point.x,
y: point.y
});
}
});
chartObj.detailChart.series[series].setData(detailData);
}
Okay, looking at your code, there's a few things you can optimize:
s[series].datato a temp var. This provides a direct pointer to the data instead of having to accesss[series].dataeach iteration of the loop. Same principle as #1I'm not saying this edit will work miracles, but it should reduce the load a bit.