# Some general questions

**URL:** <https://discourse.nodered.org/t/some-general-questions/86050>\
**Category:** General\
**Created:** [1 March 2024 10:02 UTC](https://discourse.nodered.org/t/some-general-questions/86050 "2024-03-01T10:02:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![EaB11](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@EaB11](https://discourse.nodered.org/u/EaB11)\
**Post date:** [1 March 2024 10:02 UTC](https://discourse.nodered.org/t/some-general-questions/86050/1 "2024-03-01T10:02:56Z")

</div>

hi all.. i have been building some things in Node Red recently and its been going quite well.. i have limited software development knowledge though and as i have been progressing i have started to wonder about a few things... i thought id ask..

1. I have a flow which seems like its getting pretty big.. i would say maybe 60-70% of the canvas is full of nodes.. what are the limits on size and complexity of a flow ? my guess is my flow isn't as complex as many other projects but i am curious what would be considered "getting too big" ? i currently have around 250 nodes probably 400 or so link nodes.. i will probably need to add another 20-30% in order to finish what i'm trying to do.. i'm running on a RPI5 and so far it still feels responsive..

2. a few months back when i started i had even less knowledge and i now see things where i used 3-5 nodes which could be achieved in a single function node or at least consolidated into less nodes.. does using 4 or 5 nodes severely impact performance compared to achieving the same task in a single function ? or is it mainly just consuming visual space on the canvas ?

3. is there any tricks to re organize a single large flow into multiple sub flows ? or does it require manually changing everything one by one ? is there anyway to do "find and replace" which can scan all nodes and change references from flow contexts to global ? or is the only way manually ?

i have seen things which say using sub flows is better than one larger flow and if i could go back and start again i would have done that from the start but i didn't know how large things were going to get..

1. i have built the web interface using dashboard 1.0.. i've noticed there are dashboard 2.0 nodes also.. is there any drawback to continuing to use dashboard 1.0, will it stop working in browsers anytime soon ?

thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 March 2024 10:16 UTC](https://discourse.nodered.org/t/some-general-questions/86050/2 "2024-03-01T10:16:33Z")

</div>

Do you have any duplicate functions or duplicate flows that you could feasibly reduce to a _subroutine_? If yes, then using link-call is the better option.

> [@EaB11](#):
>
> is there any tricks to re organize a single large flow into multiple sub flows

You can select items to make into a subflow and "convert" to subflow. however, all you are doing is _hiding_ nodes (and actually adding complexity) - unless the flow is stateful AND is a duplicate, there is little benefit to subflows.

A better way of organising would be to split sections with link nodes and put them on other tabs. there is a quick action for this (rightclick, split with link nodes)

![chrome_k1gPQWDAtT](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ec16e856278c0fa10515ab4c7bf473d5c02b7474.gif)

> [@EaB11](#):
>
> does using 4 or 5 nodes severely impact performance compared to achieving the same task in a single function ?

Not really much benefit either way. However, if you reduce 100 of these situations, your flow file will be smaller and the browser will be more responsive. Processing wise, at the core, not much difference.

> [@EaB11](#):
>
> i have built the web interface using dashboard 1.0.. i've noticed there are dashboard 2.0 nodes also.. is there any drawback to continuing to use dashboard 1.0, will it stop working in browsers anytime soon ?

Soon? possibly not, but some day yes. Also, it is very old tech under the hood. If you can switch, i would recommend it.

---

<div class="post-metadata">

**Author:** ![EaB11](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@EaB11](https://discourse.nodered.org/u/EaB11)\
**Post date:** [1 March 2024 11:47 UTC](https://discourse.nodered.org/t/some-general-questions/86050/3 "2024-03-01T11:47:24Z")

</div>

if i put some sections of the flow on link nodes and place them on other tabs is that still considered the same flow ? i was under the impression a different tab represented a sub flow ?

if i could put things on different tabs but keep all the same flow.context stuff ive setup that would be great.. the main thing i need is visual organization.. ive been dreading the thought of moving nodes to other tabs because i thought id need to change all the flow context variables to global context in lots of function nodes ive made...

good to know using multiple nodes doesn't impact processing side too much.. i'll switch to dashboard 2.0.. i'll get it finished first and then treat that switch as another project in itself.. appreciate the help..

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 March 2024 11:57 UTC](https://discourse.nodered.org/t/some-general-questions/86050/4 "2024-03-01T11:57:56Z")

</div>

> [@EaB11](#):
>
> i was under the impression a different tab represented a sub flow

No, a subflow is different to a tab. A Tab is just a different page of the main flows (visual thing only).

> [@EaB11](#):
>
> if i could put things on different tabs but keep all the same flow.context stuff ive setup that would be great

No, flow context is per tab. This is a good reason to ~~understand~~ learn if you are using context unnecessarily. It is almost ALWAYS preferable to program "pure" (search pure programming principle) - it essentially means if you pass something into a function (flow/subflow) you should always get the same answer and should not have side-effects (i.e. not be reliant on things like global vars AKA context). For example, had you managed to avoid using context, you could very easily move your flows around. Now, you are learning why using context (or rather not using it wisely) is problematic - pretty much like how `global` variables (in any language) are discouraged (this is the same situation you have now)

You can however, add appropriate context values to the `msg` (using a change node e.g. `msg.flowcontextStuff`), pass that via link to another tab, use the `msg.flowcontextStuff` in the other tab, then when it returns, you can update `flowcontextStuff` if necessary.

> [@EaB11](#):
>
> ive been dreading the thought of moving nodes to other tabs because i thought id need to change all the flow context variables to global context in lots of function nodes ive made...

And so you should - using flow context is bad enough, using global context has addition constraints (i.e. name clashes, even less portable).

I recommend you evaluate why you are using context. There may well be a good reason, and if so, there are ways to make it more portable.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 March 2024 12:07 UTC](https://discourse.nodered.org/t/some-general-questions/86050/5 "2024-03-01T12:07:07Z")

</div>

> [@EaB11](#):
>
> have seen things which say using sub flows is better than one larger flow

Note that subflows are not the same as flow tabs.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [1 March 2024 13:00 UTC](https://discourse.nodered.org/t/some-general-questions/86050/6 "2024-03-01T13:00:11Z")

</div>

> [@EaB11](#):
>
> I thought id need to change all the flow context variables to global context in lots of function nodes ive made

Bear in mind that Node-red works by passing data from one node to the next. Rather than saving a context variable, attach the data to the message.

```auto
flow.set('meaningoflife', 42) // Bad form

msg.meaningoflife = 42 // Good form

```

```auto
//Bad
let previousvalue = global.get('previousvalue') || 0
let newvalue = msg.payload + previousvalue
global.set ('previousvalue', newvalue)

//Better 
let previousvalue = context.get('previousvalue') || 0
let newvalue = msg.payload + previousvalue
context.set ('previousvalue', newvalue)

```

---

<div class="post-metadata">

**Author:** ![EaB11](https://avatars.discourse-cdn.com/v4/letter/e/ecb155/32.png) [@EaB11](https://discourse.nodered.org/u/EaB11)\
**Post date:** [1 March 2024 13:44 UTC](https://discourse.nodered.org/t/some-general-questions/86050/7 "2024-03-01T13:44:32Z")

</div>

without having heard the phrase before i think i intuitively understand the idea of pure programming.. seems like the more robust something is the less it would need to rely on external input.. for myself right now (with my level of skill) using flow context kinda helps to see the solution in my minds eye, i can see how it makes a design fragile though... i'll pay attention to trying to minimize it with the next thing i work on..

good thing for now ive got most of the functionality working in this little project and its been rewarding to build... i'll treat the task of tidying it up as a chance to improve..

thanks all for the help...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 May 2024 13:45 UTC](https://discourse.nodered.org/t/some-general-questions/86050/8 "2024-05-30T13:45:20Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
