Tag Script or Gateway Script

I have script and working fine when I did it on Gateway script or tag script ,my question is
Which is the right way for the system performer, Build script on tag script or on the Gateway script?

Both have same performance. So no different.
But in use case is different.
Use tag script for situation where you have object ordient design. For example you create UDT for flow meter and yup want to totalize it to calculate volume.
You better put your code in tag change script.
But for globally approach you use gateway script.

They do not have the same performance: tag events are in a limited thread pool with a queue limit.
Tag events are also limited to calling scripts in the global scripting module. Gateway tag change events can call scripts in their own project. And they are enabled/disabled with the project as a whole, without having to disable the subscribed tag.

I avoid tag events like the plague.