From 22a3f47060216d342000653ad33f93958da8156f Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Wed, 20 Aug 2025 18:40:19 +0100 Subject: [PATCH] Speed up split node fixes #5251 The code changed from 4.0.x to 4.1.x This change to to prevent making changes to the orginial input `msg` object incase any values were stored in context (pass by refernce). The change meant that for every output message the whole original input `msg` was being cloned, which could be huge, causing a big performance regresion. This fix ensures the clone of the orginial `msg` is only done once and the much smaller output message is then cloned again to update `msg.parts` object for each output. This results in lots of small clones rather than lots of very large clones. --- .../node_modules/@node-red/nodes/core/sequence/17-split.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/sequence/17-split.js b/packages/node_modules/@node-red/nodes/core/sequence/17-split.js index 5fe6b3c4e..44745a21a 100644 --- a/packages/node_modules/@node-red/nodes/core/sequence/17-split.js +++ b/packages/node_modules/@node-red/nodes/core/sequence/17-split.js @@ -146,16 +146,16 @@ module.exports = function(RED) { var pos = 0; var data = value; msg.parts.len = node.arraySplt; + const newmsg = RED.utils.cloneMessge(msg) for (var i=0; i