# How fast is Node-Red?

**URL:** <https://discourse.nodered.org/t/how-fast-is-node-red/19014>\
**Category:** General\
**Created:** [11 December 2019 11:54 UTC](https://discourse.nodered.org/t/how-fast-is-node-red/19014 "2019-12-11T11:54:02Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [13 December 2019 17:16 UTC](https://discourse.nodered.org/t/how-fast-is-node-red/19014/15 "2019-12-13T17:16:25Z")

</div>

Did some optimizations for your function. Left in comments to explain the changes.  
As I don't have any PI (or similar low performance machine) I really can't say will it help or how much it changes .

For performance gain, [node-red-contrib-unsafe-function (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-unsafe-function) is faster than regular function.

> var values = msg.payload.trim().split(",");  
> // the need of trim.() should be avoided at data creation.
> 
> if(values.length \< 5){  
> // if parsing does not create all elements, then do nothing and return early  
> return  
> }
> 
> // data considered to be ok. create output.  
> msg.topic="sensor-data";
> 
> // removed outMsg object  
> // temporary object creation, if not needed is just waist of memory.  
> // Lack of memory affects also CPU usage.
> 
> // parseFloat does not provide radix option!  
> // parseFloat(string, radix) does not fire any error but also has no effect
> 
> // parseFloat(string) returns NaN if value can not be converted to number  
> // if NaN happened, assigne default (-999.0)
> 
> msg.payload = {  
> rate: parseFloat(values[0]) || -999.0,  
> xaxis: parseFloat(values[1]) || -999.0,  
> yaxis: parseFloat(values[2]) || -999.0,  
> zaxis: parseFloat(values[3]) || -999.0,  
> temp: parseFloat(values[4]) || -999.0  
> }
> 
> return msg;

---

_[View the full topic](https://discourse.nodered.org/t/how-fast-is-node-red/19014)._
