# Ignition 8.1 Slow Executing Scripts

**URL:** <https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [October 30, 2024, 7:44pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971 "2024-10-30T19:44:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [October 30, 2024, 7:44pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/1 "2024-10-30T19:44:12Z")

</div>

Hey Ignition community, running into an issue here. Ill post the scripts if asked to, but I'm seeing some insanely high wait times on executing these scripts (20+ seconds). mainly moving around strings, or using a OPC tag to set a memory tag true, all taking about 20 seconds to do so. Scan class is set to default (1000ms). Thanks or helping if you can.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [October 30, 2024, 7:50pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/2 "2024-10-30T19:50:03Z")

</div>

Here's a few

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e79222f372154f0e4e63a2c7ba6ba694e1c1e941.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/2/120724e7475136884f874b956df0835c5a7bb599.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a9aaa7d63cc618c3b93dfcfff2aa6647b426c157.png)

two scripts, same 20+ second execution time

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [October 30, 2024, 7:51pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/3 "2024-10-30T19:51:21Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/1/5129e938931b87912193794ce5217f501a362945.png)  
also useful info

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 30, 2024, 7:54pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/4 "2024-10-30T19:54:46Z")

</div>

You haven't posted the script as preformatted text, and I'm not really at a place where I can retype all of that, however, I will say two things:

1. You should not be running blocking read or writes in tag value change scripts. There are good reasons for that, without getting into the details lets just say you want them to execute as quickly as possible.
2. The read and write functions all take a list of tag paths. You should perform all reads/writes in a single call at the beginning of the script for reads and the end of the script for writes. That on it's own will help your performance greatly.

Also:

This:

```python
if currentValue.value == True

```

is functionally equivalent to:

```python
if currentValue.value

```

But the second is more pythonic.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 30, 2024, 7:55pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/5 "2024-10-30T19:55:45Z")

</div>

Tag events run in a limited thread pool (three threads, by default). You must not do anything in a tag event script that takes more than a handful of milliseconds. (Like, single digit milliseconds.)

This means your tag events must not:

- Make any database calls, except Insert/Update via the Store and Forward system.

- Make any direct OPC reads, or any OPC tag writes, or direct OPC writes, as these block for many seconds if there are communication problems.

- Use any system or java functions that will block on any other network activity.

- Use any system or java functions that access large amounts of data in a filesystem.

- Use any form of `.sleep()` or any form of busy-looping.

If you need any of the above, use a project-level Gateway Tag Change event (or multiple such) instead of event scripts attached directly to the tag.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 30, 2024, 7:57pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/6 "2024-10-30T19:57:16Z")

</div>

A thread dump would be useful here.

> **[Diagnostics - Threads | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/platform/gateway/status/diagnostics-threads#individual-threads)**
>
> The Threads page displays a snapshot of information about Gateway’s execution threads. This information may be important when troubleshooting certain types of issues. If you are working with Support, you may be asked for a thread dump.

---

<div class="post-metadata">

**Author:** ![Lynn\_Martineau](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@Lynn\_Martineau](https://forum.inductiveautomation.com/u/Lynn_Martineau)\
**Post date:** [October 30, 2024, 10:37pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/7 "2024-10-30T22:37:29Z")

</div>

also... when you get this moved to a project gateway script (see @pturmel  
and @lrose comments), readBlocking and writeBlocking are intended to read/write multiple tags in a single pass.  
Instead of using a series of readBlocking or writeBlocking statements, build your paths and values into lists (e.g.`tagPaths[], tagValues[]`) then use a single `readBlocking(tagPaths)` and a single `writeBlocking(tagPaths,tagValues)`.  
You'll see execution improvements on an order of magnitude doing that.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [October 31, 2024, 5:57pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/8 "2024-10-31T17:57:32Z")

</div>

You should really pack all your `readBlocking` calls into a single call

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [October 31, 2024, 7:27pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/9 "2024-10-31T19:27:09Z")

</div>

New to 8.1, so first time around with read/writeBlocking functions. would a standard system.tag.read/write work like in 7.9?

also I found the issue last night. I had a script running every second off a getSecond(now()) expression instead of what it was supposed to be, getDay(now()), no issues after that change.

---

<div class="post-metadata">

**Author:** ![Lynn\_Martineau](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@Lynn\_Martineau](https://forum.inductiveautomation.com/u/Lynn_Martineau)\
**Post date:** [October 31, 2024, 7:58pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/10 "2024-10-31T19:58:56Z")

</div>

In 7.9 there is a `system.tag.readAll` and `system.tag.writeAll` that accepts lists as arguments.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 1, 2024, 12:25pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/11 "2024-11-01T12:25:18Z")

</div>

> [@Jason\_Platt](#):
>
> would a standard system.tag.read/write work like in 7.9?

No, they aren’t exactly the same.

In 7.9 `system.tag.write` is an asynchronous operation, where `system.tag.writeBlocking` is, as the name suggests, a blocking operation.

In 8.1 if you want to write and forget, then you should use `system.tag.writeAsync()`.

The functions are also intended to take a list of tag paths and they always return a list of qualified values.

There is a reason that IA went to all the trouble to rejig the functions naming and all.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [December 22, 2025, 8:43pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-slow-executing-scripts/97971/12 "2025-12-22T20:43:40Z")

</div>

This still happens in 8.3?
