How things work - compiled vs interpreted

Could you please help me to understand why ignition has to be interpreted while running rather than compiled. What are fundamental reasons for compiling not being possible?
Regards

Which parts are you referring to as being interpreted?

scripting part uses jython 2.7 and for sure it is interpreted but i was wondering if some other language was used instead of python - would then compile be possible at all?. Apart from scripting in jython we have internal language which is also interpreted, then if somebody is experience its possible to write extension in Java - that would be compiled correct? Trying to organize a little bit my understanding of ignition architecture.

Python is interpreted, but Jython is actually compiled to Java bytecode and hotspot compiled by the JVM into native code.

If you wrote a module in Java with the SDK that would also be compiled.

The expression language is interpreted.

1 Like

thanks Kevin for great answer. Is it possible to say why expression language being interpreted is a way faster than jython that is hotspot compiled? Should expression language be always my preference?

Well, if you squint. The java call tree during execution of an expression is really clean. I’ve never seen it slower than runScript() or my objectScript() for comparable operations. Setting up the jython execution environment is expensive, no matter how optimized the innermost jython becomes.

1 Like

Like Phil said, the expression language turns into pretty simple and fast Java code compared to Jython.

The code powering expression execution is also Java, so if you have an expression executing over and over then all that code gets hot spot compiled too.

You generally don’t need to worry about the performance differences and if you’re doing things “right” you generally aren’t forced into making a decision between Jython or expressions.

1 Like

@pturmel in expression language i can see runScript command but not sure what did you mean by objectScript. Any chance you elaborate please?

This is in Phil’s (free) Simulation Aids module:
https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-simulation-aids
Documentation:
https://www.automation-pros.com/simaids/doc/index.html

2 Likes