Built-in scala vs embedded groovy

I am using the embedded language for my application. The application is written in pure scala. I want to add some functions at runtime. and I have a question, is scala built in faster than groovy embedded?

+4
source share
2 answers

I would not add another language, scala is great for scripting. Most likely, scala is usually faster than groovy (there are old tests on shootout.alioth.debian.org, but for some reason groovy seems to have dropped out of the current tests?). however, responsiveness is suboptimal, that is, as you know, running the “interpreter” used for scala REPL is a compiler that compiles on the fly. this happens with a slight delay for the actual compilation, but then the execution speed is the same as the usual compiled scala. on modern computers you will no longer notice this delay.

There are several small tools built on top of the scala REPL. another advantage of being in the same language may be that it is probably easier to attach characters to the interpreter, since all scala specific things (such as synthetic methods, related objects, etc.) are transparently visible.

edit: although the original post is from 2009, there are tests from the latest scala 2.8 and groovy 1.7 spreading through the comments showing the difference in magnitude: http://stronglytypedblog.blogspot.com/2009/07/java-vs-scala-vs- groovy-performance.html

+4
source

As far as I know, there have been some attempts to implement the Java API (Scripting language support, JSR 223), which is necessary to use languages ​​“as scripting languages,” but I'm not sure how well this worked.

Scala is faster than Groovy because it is more closely related to idioms that the JVM can execute quickly.

But Groovy is indeed one of the scripting languages ​​for the JVM. There should also be some support for building Java / Scala / Groovy files, so this should not be a problem.

+1
source

Source: https://habr.com/ru/post/1338887/


All Articles