| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Self-maintained QuickJS Android Bindings.
QuickJS quickJS = new QuickJS.Builder().build();
try (JSRuntime runtime = quickJS.createJSRuntime()) {
try (JSContext context = runtime.createJSContext()) {
String script1 = "" +
"function fibonacci(n) {" +
" if (n == 0 || n == 1) return n;" +
" return fibonacci(n - 1) + fibonacci(n - 2);" +
"}";
// Evaluate a script without return value
context.evaluate(script1, "fibonacci.js");
String script2 = "fibonacci(10);";
// Evaluate a script with return value
int result = context.evaluate(script2, "fibonacci.js", int.class);
assertEquals(55, result);
}
}See Usages.md for advanced usages.
git clone --recurse-submodules https://github.com/shiqimei/quickjs-android.gitOpen the folder quickjs-android in Android Studio.
This is a non-serious benchmark. The purpose is to compare the performance of QuickJS and V8 on Android.
| Engine | v8 | QuickJS (Script Mode) | QuickJS (Bytecode Mode) |
|---|---|---|---|
| init | 30ms | 18ms | 18ms |
| eval | 29ms | 282ms | 48ms |
| total | 59ms | 300ms | 56ms |
| Back | FazBrowse Home | New Git URL |