I'm having some severe performance issues with adding a large amount of links to a cycles node-graph. (seems to get exponentially worse) to the point where creating large graph from a script locks up blender for minutes (for some of my larger graphs 20+ minutes even) on end.
This patch adds 2 calls to the nodetree_link_api to begin and end a batch update.
when in batch update mode ntreeUpdateTree is prevented from firing on every single update to the list.
once you end your batch ntreeUpdateTree is called once and order is restored.
Bringing the total creation time of my graph down from 20+ minutes to mere seconds.