# typedInput performance issue?

**URL:** <https://discourse.nodered.org/t/typedinput-performance-issue/22510>\
**Category:** Core Development\
**Created:** [2 March 2020 16:26 UTC](https://discourse.nodered.org/t/typedinput-performance-issue/22510 "2020-03-02T16:26:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thierry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry/32/8654_2.png) [@Thierry](https://discourse.nodered.org/u/Thierry)\
**Post date:** [2 March 2020 16:26 UTC](https://discourse.nodered.org/t/typedinput-performance-issue/22510/1 "2020-03-02T16:26:20Z")

</div>

Hello,

I face a performance issue in the editor when using change node with several rules.  
To reproduce the "issue":

- simply create a change node with 10 to 15 rules inside (just keep default created rules and edit string payload to random string) like so:  
 ![2020-03-02 16_20_09-Design - STM32CubeMonitor](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/2543c855415f943060f28de2aa7d0dc1d9bb1aff.png)
- close the panel,
- and open it again.

The panel opening takes a lot of times and the duration is directly correlated to the number of rules.  
Also when resizing the panel, the refresh is quite long ...  
The chrome debug tool shows that the `addItem` function from `editableList` (= add one rule) takes between 150ms to 250ms which seems very to me.

I figure out that removing all the `typedInput` fields (x5 per rule) in the the `addItem` function, fixes the performance issue.

Is it something to consider as normal in term of performance ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 March 2020 17:03 UTC](https://discourse.nodered.org/t/typedinput-performance-issue/22510/2 "2020-03-02T17:03:42Z")

</div>

> [@Thierry](#):
>
> Is it something to consider as normal in term of performance ?

It certainly looks like something that needs to be improved.

In 1.0 there was a performance improvement for the Switch node that reduces the number of typedInputs that are created - only creating those that are needed as and when they are needed - [optimization for switch node · node-red/node-red@c8e14f9 · GitHub](https://github.com/node-red/node-red/commit/c8e14f91e749aeb2bd4804181900f1fcdfaef1b8)

A similar change is needed in the Change node.

---

<div class="post-metadata">

**Author:** ![Thierry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry/32/8654_2.png) [@Thierry](https://discourse.nodered.org/u/Thierry)\
**Post date:** [3 March 2020 15:47 UTC](https://discourse.nodered.org/t/typedinput-performance-issue/22510/3 "2020-03-03T15:47:36Z")

</div>

I just performed the same improvements on change node. It slightly improves the situation but still it's not perfect as there still (at least) 2 typedInput for each rule.

I also noticed some performance issue when resizing the panel width so I changed the way the "rule" width is processed. The performances are much better now when resizing.

Would you like me to raise a pull-request such as you can review my proposal and merge it if no problem ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [3 March 2020 15:48 UTC](https://discourse.nodered.org/t/typedinput-performance-issue/22510/4 "2020-03-03T15:48:41Z")

</div>

> [@Thierry](#):
>
> Would you like me to raise a pull-request such as you can review my proposal and merge it if no problem ?

Yes please.

---

<div class="post-metadata">

**Author:** ![Thierry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry/32/8654_2.png) [@Thierry](https://discourse.nodered.org/u/Thierry)\
**Post date:** [3 March 2020 18:34 UTC](https://discourse.nodered.org/t/typedinput-performance-issue/22510/5 "2020-03-03T18:34:30Z")

</div>

Done : [https://github.com/node-red/node-red/pull/2492](https://github.com/node-red/node-red/pull/2492)

---

<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:** [2 May 2020 18:34 UTC](https://discourse.nodered.org/t/typedinput-performance-issue/22510/6 "2020-05-02T18:34:35Z")

</div>

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