My code in the Editor is slow, what can I do?


Sometimes when you are editing a channel the auto-execution can start to get very slow. This usually happens because channels have a lot of code and it gets slow to compile, or there is a long channel timeout to allow for unreliable database or web service connections.

You can use iguana.isTest() to detect when you are running a development environment (test mode) and change code behaviour to improve performance. You can also use  iguana.setTimeout() to reduce the channel timeout.

Issue [top]

What to do when your code is slow in the Editor.

Solution [top]

You can do a couple of things:

How it Works [top]

The more code you have in your channel the longer it will take to compile, eventually this slows down the Editor enough to become annoying. Disabling auto-execution can be useful in this scenario. You may also find using iguana.isTest() helpful as you can bypass portions of the code (that are slow to compile) and simply return dummy/test data instead.

If you are using external services like databases or web services which can be unreliable, then you will need a longer channel timeout to allow for delayed responses. Such timeouts are appropriate for a Production system, but can waste a lot of time during development. You can use iguana.setTimeout() to reduce the timeout for a development environment to maybe 15 seconds — as opposed to the default of 15 minutes. Alternatively you could use iguana.isTest() to simply return some dummy/test data instead of querying a database or web service (thus avoiding timeouts altogether).

Leave A Comment?