I have an array of objects like this:
var chartData = [{count: 0, idTag: \"24\"}
{count: 0, idTag: \"25\"}
{count: 0, idTag: \"
I would suggest using client side database storage mechanisms, and let the queries do the counting for you.
This makes it more overseeable and reduces menory warnings from various virusscanners, plus you dont need to refetch data everytime.
Another approach would be to use a server side database and retrieve the values you want via json.
another aproach toprevent browser freeze is to let your loop run in a webworker so its a thread and doesnt lock the browser.