Template seems running extremely slow with merge engines

Hi,

When I run my content creation with the template. It looks like its running extremely slow to a point that, its stuck to around 40-50%.

My content creation includes a datamapper. When I run the datamapper in workflow 15000 records it finished with no issues in short amount of time.

But comes content creation, the first 25% was pretty quick until half way mark.

All I can think of is there is something in my template thats making it slow and that making me think there could be a progressive loop in my script that keeps getting bigger. I removed all my loops in my template to check.

Meanwhile I saw some posts here talking about sections being disabled:

Could this code be responsible?


// Clone section for multiple notices
clones = {};

noticeCount   = record.detail.length;
originSection = merge.template.contexts.PRINT.sections["Section 1"];

for(var n = 0; n < noticeCount; n++){
	// Clone 
	var newClone     	    = originSection.clone();
	newClone.name    		= "Section " + n;
	newClone.enabled 		= true;
	clones[newClone.name]  = {index: n};
	
	// Remove 2nd sheet if there is no water charge
	var waterCharges = record.detail[n]._waterCharges;
	if(waterCharges.index.length<=0){
		newClone.background.start = 1;
		newClone.background.end   = 2;
	}
	
	// Add new section
	originSection.addAfter(newClone);
	
}

originSection.enabled = false;

Thank you in advanced.

Looking at the code, it doesn’t seem likely that this is what’s causing the slowdown. Are there other parts of the template you could isolate, such as disabling sections or scripts? I’d be happy to take a quick look at your document—feel free to send me a direct message.

Thanks Erik. I have sent you a DM.

Kind regards,
Ernani