In order to understand the problem that will arise by leaving unused tags in the custom expressions item list, we need to look at how data will be provided to the custom expression.
Data will be structured and returned in what is known as a "Wide Query". What this means is that each tag in the list will be supplied as columns in the result set.
Normally data is also queried on a "Delta" retrieval. So you will only get a result every time the tag's value changes.
Example
Let's say we want to determine an event stop trigger with a custom expression. We have a tag that historizes the machine state and from the state engine we know if the machine is in state 20, it is stopped:
In this case, we will have 3 stop triggers.
Now let's say we wanted to use the energy usage in our expression as well. Now, because of the way a wide query returns data, it will have a massive impact on the result set.
The reason is that power will change much more frequently than the machine state, thus a record of the machine state will be "duplicated" to accommodate data in the same row as the power:
So, the machine's state value is duplicated with every change in the the power meter's measured value!
If your event stop trigger is configured to execute every time the machine state is equal to 20, you will have a lot more stop triggers than the expected 3 triggers:
Thus, only keep items in your item list that are utilized in your custom expression.