CPython and Node-Red

It seems that Python and Compiled Python along with the optimizers are moving along to the point that we can incorporate compiled code into things like node-red to speed things up.

I was wondering how others feel about this. We could build up code and ultimately compile it into Node-Red

If you feel the need to write in both python and javascript hen feel free.
Of course Node-RED isn't compiled and we don't want a compile step to have to happen - but if you precompile a module into your own node then that should work. (As many nodes already include native (most C, C++) code eg serialport)

It would be an optional thing to speed up certain repetitive code. What I envision is the ability to take a flow and compress it down to a single compiled node.

That is a very large and fundamental change to the way that Node-RED currently works. Also not sure that it really aligns with the JavaScript/Node.js architecture of Node-RED.

Perhaps when NR has matured to the stage you can run flows fully independently of the Editor, the underlying architecture might then support such a further change? However, with so many other pressing enhancements on the roadmap, I can hardly think this will be very high on anyone's list.

1 Like

Yes, I think this is the course it will take. I just see node-red very much in line with a concept of programing on visual logic blocks that we discussed back at Sun Microsystems. I think that the blocks will evolve into optimized set standards over time and that new nodes will find merit over time and each year be voted into the formal library based on merit. Then the formal modules get refinement into speed and optimization.

I always proposed the sort blocks since they could look at the data and figure which one to choose.

Also I always proposed a way that the block engine could call on the spare CPU cycles of the neighborhood to run the blocks and that the space was unable to access the local OS space.

It was in the days of "The network is the computer" I said that in my early job interview and it stuck with the company.

The blocks have to be only the formally approved at that point.

Proposals are all very good - but "show me the code" ! Also I'm sure the native node.js engines will continue to improve also so there will be gains there too.

In the meantime - there is nothing to stop you writing code for a node in whatever language you want to compile as long as it ends up as a node.js binary - this is what node-gyp does for quite a few nodes that require native bindings. Currently this does causes issues now and again (see continuing threads re installing i2c devices on nodejs 12 - where precompiled code is not available for the processors required etc..) - but hey - doesn't stop anyone trying with other languages to see how fast it can go.

I await to see the benchmarks.