Pros and Cons about using "custom" Functions vs the basic set of nodes

Great work, thanks for doing this. Really useful.

1 Like

@kazuhitoyokoi - do you have a simple set of steps to create the nodegen fuction blocks? Or do I have to wade thru that info to create them?

The README.md in node-red-nodegen project has simple steps to create nodegen function nodes as follows.

## Installation
* sudo npm install -g node-red-nodegen

### Create original node from function node
* On Node-RED flow editor, save function node to library with file name (lower-case.js).
* node-red-nodegen ~/.node-red/lib/function/lower-case.js
* cd node-red-contrib-lower-case
* sudo npm link
* cd ~/.node-red
* npm link node-red-contrib-lower-case
* node-red
-> You can use lower-case node on Node-RED flow editor.

You can also create "function node without vm module" using the following steps.

## Installation
* git clone https://github.com/kazuhitoyokoi/node-red-nodegen.git
* cd node-red-nodegen
* git checkout master-functionwithoutvm
* npm install

### Create original node from function node
* On Node-RED flow editor, save function node to library with file name (lower-case.js).
* node bin/node-red-nodegen.js ~/.node-red/lib/function/lower-case.js --name lower-case-wovm
* cd node-red-contrib-lower-case-wovm
* sudo npm link
* cd ~/.node-red
* npm link node-red-contrib-lower-case-wovm
* node-red
-> You can use lower-case-wovm node on Node-RED flow editor.

In the future, Node-RED flow editor will be able to have nodegen UI. Currently there is the design note about the UI.

I've just pushed a fix to git that restores the performance of the Switch node:

Number of messages Function Time (ms) Switch Time (ms)
16384 1216 331
32768 2081 600
65536 4125 1124
131072 8282 2207

This fix only applies if the node doesn't try to access context.

I suspect a similar performance regression will have been introduced to the Change node - I'll sort that out next.

3 Likes

Thank you for the optimization. :slight_smile: I'll use the new version of Node-RED!