Array of objects javascript
With your description, the best options is to speed process by caching elements.
var links = [];JG = jsonFile.generations;for (i = 0, endI = JG.length; i < endI ; i++) { JGIN = JG[i].nodes; for (j = 0, endJ = JGIN.length ; j < endJ ; j++) { JGINJ = JGIN[j]; JGINJAS=JGINJ.after.stid; JGINJBS=JGINJ.before.stid; for (w = 0, endW = JGINJAS.length; w < endW ; w++) { links.push({ source: JGINJAS[w], target: JGINJBS[w], type:"medium" }); } }}
This reduce the needed time, but does not avoid the creation of the array of i*j*w objects.
Best option should be to change the code that manages the array, so it uses a callback to get the element, and use this callback to dinamically determine the element in the json hierarchy that is required.