# Importing flows. Is there a difference between Formatted and Unformatted for load time?

**URL:** <https://discourse.nodered.org/t/importing-flows-is-there-a-difference-between-formatted-and-unformatted-for-load-time/26991>\
**Category:** General\
**Created:** [20 May 2020 10:46 UTC](https://discourse.nodered.org/t/importing-flows-is-there-a-difference-between-formatted-and-unformatted-for-load-time/26991 "2020-05-20T10:46:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 May 2020 10:46 UTC](https://discourse.nodered.org/t/importing-flows-is-there-a-difference-between-formatted-and-unformatted-for-load-time/26991/1 "2020-05-20T10:46:55Z")

</div>

If I import a chunk of code which was exported as _formatted_ it seems to take longer for the `IMPORT` button to activate than if the code wasn't _formatted_.

Is this to be expected?

---

<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:** [20 May 2020 11:47 UTC](https://discourse.nodered.org/t/importing-flows-is-there-a-difference-between-formatted-and-unformatted-for-load-time/26991/2 "2020-05-20T11:47:43Z")

</div>

Can you quantify 'longer'? I'd be surprised if any difference was that noticeable. Obviously the formatted version is simply more raw data to parse the JSON from - but the browser's built-in JSON parser is so highly optimised.

Once the raw JSON has been parsed to its JavaScript object format, then there is absolutely no difference.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 May 2020 11:55 UTC](https://discourse.nodered.org/t/importing-flows-is-there-a-difference-between-formatted-and-unformatted-for-load-time/26991/3 "2020-05-20T11:55:13Z")

</div>

Ok, here's the code I was using.

```auto
[{"id":"8d34d18c.a5c1d8","type":"subflow","name":"Time Stamp","info":"","category":"","in":[{"x":80,"y":100,"wires":[{"id":"e238745c.805ad"}]}],"out":[{"x":780,"y":180,"wires":[{"id":"e238745c.805ad","port":0},{"id":"f4d2e3a6.04b528","port":0}]},{"x":780,"y":230,"wires":[{"id":"e238745c.805ad","port":0},{"id":"f24c822.a42738","port":0}]},{"x":780,"y":280,"wires":[{"id":"5da44411.ed02ac","port":0},{"id":"e238745c.805ad","port":0}]}],"env":[],"color":"#FF8888","outputLabels":["For logging use","msg.time","For filename use"],"icon":"node-red/timer.svg"},{"id":"f4d2e3a6.04b528","type":"moment","z":"8d34d18c.a5c1d8","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm:ss","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":400,"y":180,"wires":[["5da44411.ed02ac","3a4de0cb.6235d"]]},{"id":"5da44411.ed02ac","type":"string","z":"8d34d18c.a5c1d8","name":"","methods":[{"name":"replaceAll","params":[{"type":"str","value":":"},{"type":"str","value":""}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":450,"y":280,"wires":[[]]},{"id":"3a4de0cb.6235d","type":"change","z":"8d34d18c.a5c1d8","name":"TOPIC","rules":[{"t":"move","p":"payload","pt":"msg","to":"time","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":230,"wires":[["f24c822.a42738"]]},{"id":"e584e350.1d8a48","type":"change","z":"8d34d18c.a5c1d8","name":"Save","rules":[{"t":"set","p":"payload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":140,"wires":[["3411b340.b65a04"]]},{"id":"f24c822.a42738","type":"change","z":"8d34d18c.a5c1d8","name":"Get","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":230,"wires":[[]]},{"id":"e238745c.805ad","type":"switch","z":"8d34d18c.a5c1d8","name":"check topic","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"TIMESTAMP","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":100,"wires":[[],["e584e350.1d8a48"]]},{"id":"3411b340.b65a04","type":"change","z":"8d34d18c.a5c1d8","name":"TimeStamp","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":210,"y":180,"wires":[["f4d2e3a6.04b528"]]},{"id":"84793313.9eb1f8","type":"simple-queue","z":"c3ec93b2.f3154","name":"queue1","firstMessageBypass":false,"bypassInterval":"0","x":4171,"y":341,"wires":[["b2db71d0.6450c8"]]},{"id":"b2db71d0.6450c8","type":"debug","z":"c3ec93b2.f3154","name":"Local Readings error list","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":4365,"y":341,"wires":[]},{"id":"bf9b7edc.b27e88","type":"change","z":"c3ec93b2.f3154","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"error","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":4365,"y":290,"wires":[["d8b4632b.91ab","84793313.9eb1f8"]]},{"id":"61128523.7660dc","type":"change","z":"c3ec93b2.f3154","name":"Wipe","rules":[{"t":"set","p":"reset","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":3985,"y":381,"wires":[["84793313.9eb1f8"]]},{"id":"c439155a.75d63","type":"change","z":"c3ec93b2.f3154","name":"Read","rules":[{"t":"set","p":"trigger","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":3985,"y":341,"wires":[["84793313.9eb1f8"]]},{"id":"d8b4632b.91ab","type":"fan","z":"c3ec93b2.f3154","x":4530,"y":290,"wires":[["3d50ba40.6be6fe","d15571c9.13587"]]},{"id":"7751be91.a10ca8","type":"gate","z":"c3ec93b2.f3154","name":"","controlTopic":"control","defaultState":"open","openCmd":"go","closeCmd":"stop","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":4160,"y":290,"wires":[["bf9b7edc.b27e88"]]},{"id":"2aad0538.85a8da","type":"inject","z":"c3ec93b2.f3154","name":"Wipe","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":3805,"y":381,"wires":[["61128523.7660dc"]]},{"id":"ca3cfbd.84ddb08","type":"inject","z":"c3ec93b2.f3154","name":"Read","topic":"","payload":" ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":3805,"y":341,"wires":[["c439155a.75d63"]]},{"id":"3d50ba40.6be6fe","type":"function","z":"c3ec93b2.f3154","name":"","func":"var name = flow.get('name');\nvar ok = global.get('Error_Flow_Pass');\nvar stop = global.get('Error_Flow_Stop');\nvar caught = global.get('Error_Detected');\n\n//node.warn(\"Name of the flow \" + name);\n// -- check if this is a CONTROL message.\nif (msg.topic == 'CONTROL')\n{\n //node.warn(\"Control signal received \" + msg.payload);\n if (msg.payload == 'STOP')\n {\n context.set('notify',1);\n msg.topic = name;\n msg.colour = stop;\n } else\n {\n context.set('notify',0);\n msg.topic = name;\n msg.colour = ok;\n }\n return msg;\n}\n\n// -- Send YELLOW as the message if error detected.\n//\tThis is only if the error reporting is blocked.\nvar pass = context.get('notify') ||0;\nif (pass == 1)\n{\n // set msg.payload to indicate\n node.warn(\"Error detected check indication\");\n msg.topic = name;\n msg.colour = caught;\nreturn msg;\n}\n","outputs":1,"noerr":0,"x":4690,"y":240,"wires":[["28bc75d2.52e8f2"]]},{"id":"d15571c9.13587","type":"gate","z":"c3ec93b2.f3154","name":"","controlTopic":"CONTROL","defaultState":"open","openCmd":"GO","closeCmd":"STOP","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":4694,"y":290,"wires":[["3d59b15b.23af46"]]},{"id":"b25404aa.f397a","type":"function","z":"c3ec93b2.f3154","name":"Name flow","func":"var device_name =global.get('myDeviceName');\nvar flow_name = flow.get('name');\nmsg.topic =\"ERROR_REPORT/\" + device_name + \"/\" + flow_name + \"/\" + msg.topic;\nreturn msg;","outputs":1,"noerr":0,"x":3965,"y":291,"wires":[["86b24b94.507158","7751be91.a10ca8"]]},{"id":"763e5261.64db2c","type":"inject","z":"c3ec93b2.f3154","name":"Stop","topic":"control","payload":"stop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":3985,"y":211,"wires":[["7751be91.a10ca8"]],"icon":"node-red/alert.png"},{"id":"814af59f.b01a28","type":"inject","z":"c3ec93b2.f3154","name":"Go","topic":"control","payload":"go","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"1","x":3985,"y":251,"wires":[["7751be91.a10ca8"]]},{"id":"d9330cd4.cbf8d","type":"change","z":"c3ec93b2.f3154","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"CONTROL","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":3985,"y":171,"wires":[["7751be91.a10ca8","303460a0.d2669"]]},{"id":"28bc75d2.52e8f2","type":"link out","z":"c3ec93b2.f3154","name":"Flow error TX","links":["bb335d19.a8936"],"x":4875,"y":240,"wires":[],"l":true},{"id":"37a662b8.9299ce","type":"inject","z":"c3ec93b2.f3154","name":"Stop","topic":"CONTROL","payload":"STOP","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":4530,"y":200,"wires":[["d15571c9.13587","3d50ba40.6be6fe"]]},{"id":"76a095e2.26c4a4","type":"inject","z":"c3ec93b2.f3154","name":"Go","topic":"CONTROL","payload":"GO","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"1","x":4530,"y":240,"wires":[["d15571c9.13587","3d50ba40.6be6fe"]]},{"id":"a5afb31f.066a","type":"fan","z":"c3ec93b2.f3154","x":4556,"y":151,"wires":[["3d50ba40.6be6fe","d15571c9.13587"]],"l":false},{"id":"3d59b15b.23af46","type":"function","z":"c3ec93b2.f3154","name":"Set topic","func":"var device_name =global.get('myDeviceName');\nmsg.topic =\"ERROR_REPORT/\" + device_name + \"/\" + msg.topic;\nreturn msg;","outputs":1,"noerr":0,"x":4705,"y":340,"wires":[["b576c1e2.d35258"]]},{"id":"86b24b94.507158","type":"debug","z":"c3ec93b2.f3154","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":4160,"y":250,"wires":[]},{"id":"7c0f52af.066f44","type":"subflow:8d34d18c.a5c1d8","z":"c3ec93b2.f3154","name":"","x":3801,"y":291,"wires":[[],["b25404aa.f397a"],[]]},{"id":"303460a0.d2669","type":"link out","z":"c3ec93b2.f3154","name":"Runaway","links":["8da8c919.68c64"],"x":4165,"y":171,"wires":[],"l":true},{"id":"fa49e832.711c18","type":"switch","z":"c3ec93b2.f3154","name":"> 30","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"30","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":3825,"y":171,"wires":[["d9330cd4.cbf8d"]]},{"id":"7c008ca0.14bcf4","type":"link in","z":"c3ec93b2.f3154","name":"Error_CTL","links":["14730b0b.ee4ecd"],"x":4421,"y":151,"wires":[["a5afb31f.066a"]],"l":true},{"id":"b576c1e2.d35258","type":"link out","z":"c3ec93b2.f3154","name":"Error TX","links":["a5a912e5.4f2d4"],"x":4860,"y":340,"wires":[],"l":true},{"id":"4b9e01fe.ead48","type":"catch","z":"c3ec93b2.f3154","name":"","scope":null,"x":3580,"y":290,"wires":[["4ef524cb.da58ec","7c0f52af.066f44"]]},{"id":"99689a76.7bd95","type":"inject","z":"c3ec93b2.f3154","name":"","topic":"","payload":"Test","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":3595,"y":331,"wires":[["7c0f52af.066f44"]]},{"id":"4ef524cb.da58ec","type":"msg-speed","z":"c3ec93b2.f3154","name":"Speed check","frequency":"sec","estimation":false,"ignore":false,"x":3805,"y":241,"wires":[["fa49e832.711c18"],[]]}]

```

So that is in/on a page.

I export it and say `formatted`.

`Copy to clip board`.

Unselect the nodes.

Scroll down a bit on the screen.

`import`. `paste`

## _bang!_ It's ready.

(`import` button red)

Press `delete` to get rid of the nodes.

Scroll back up.  
Reselect the nodes.

`export - formatted`

`copy to clip board`

Unselect the nodes.

Scroll down a bit on the screen.

`import`. `paste`.........

25 seconds before the `import` button is red.

Just wondering.

Yes, I am kind of flogging the machine (RasPi 2a I think)

But......

Just asking.

# EDIT

Ok, tried it on a faster machine.  
Time is down to mere seconds.

But there does seem to be a difference in _parsing times_ depending on if the _code_ is formatted or not.

If you are importing a lot of code to a small machine: the format will (does?) affect how long it takes before the `import` button becomes alive.

---

<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:** [19 July 2020 11:55 UTC](https://discourse.nodered.org/t/importing-flows-is-there-a-difference-between-formatted-and-unformatted-for-load-time/26991/4 "2020-07-19T11:55:18Z")

</div>

Closed on 19 July 2020 11:55 UTC

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