I have a generic query - are there performance guidelines that the flow implementer should keep in mind ? Example - when i search the forum i read function node is more expensive .
Implementation of few lines of code involving- if () && - kind of logic - then may need multiple switches and then more nodes. ... can be done with a single function node.
In which scenarios would function node be recommended ? (From performance perspective only).
So in case there are any guidelines - which nodes are generally more expensive in terms of performance .. it can help.
A function node has to create a Node.JS "virtual machine" to wrap the code in. That makes the function node a lot safer, especially for people with limited JavaScript skills. However, there is a small processing overhead.
As Steve says, the change node will be more efficient for simple changes. However, if you use JSONata in a change node, that is almost certainly slower than a function node (but sometimes the logic is a lot simpler).
But as Steve also say's - performance on a low-code platform is generally a lot less important than being able to create and follow the logic. Forget about it until it starts to be a problem - which may be never, even on a limited capacity Pi.
Note - it only creates that nodejs virtual machine once... and then re-uses it - so the very first time it it slow - but after that the overhead is then only that of passing data in and back out... (which does have an overhead but much much smaller than the initial creation)... So yes... not really worth worrying about.
Note2 - any change node using the jsonata operation can also be slow.