Kotlin JavaScript Engine implementation


#1

Does anyone know which JavaScript engine Kotlin is using to evaluate Javascript? I found the following class

KotlinJsr223ScriptEngineFactoryExamples.kt

looking at the class source KotlinJsr223ScriptEngineFactoryExamples.kt could see the following dependency

import javax.script.Bindings
import javax.script.ScriptContext
import javax.script.ScriptEngine

I’m wondering whether Kotlin is based on already existing Javascript Engines like Nashorn or Rhino or it’s running its own implementation. I’m considering to port my lib to Korlin, the performance is extremely important for me, base on my tests Hashorn is losing to Rhino. So I want to find out, what engine Kotlin is executing behind the senses.

Thanks in advance


#2

Kotlin does not have its own JS engine. Kotlin-JS does not implement JS interpreter, just compilation to JS.