Calling Scala from Java does not bring any overhead: all this is just bytecode when it is executed. It is not as if you had to travel through some kind of bridge between Java and Scala, as you would if you were calling from Java in, I donβt know Python.
Whether the implementation of this particular Scala algorithm is faster or slower will depend on the nature of the algorithm and how it is implemented. Given that you are not going to implement it equally in two languages, it is very difficult to predict.
source share