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. Also large database queries that take a long time will slow down the annotations.
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.
What to do when your code is slow in the Editor.
You can do a couple of things:
- If you have a large project that takes a long time to compile you can disable auto-execution and run the code manually when you want to update annotations.
- Also you can modify the code to run quicker in the editor using
- If you have slow database queries you can do various things to speed them up:
- You can use a development database with limited data — so you get smaller result sets
- You can change the queries to return less row for example SELECT TOP 10 <query> will be much faster:
- You can optimize the queries for better performance — your production users will appreciate this too:
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).
Large (and slow) Database queries will slow down the editor as they need to be refreshed (run) each time the code is changed — because the annotations need to be refreshed.