JSI Benchmarking on Android at Myntra

Related tags

Miscellaneous jsi
Overview

What is JSI?

It's an interface which enables JavaScript (whether it's JSC or Hermes) to communicate with native (C++) and vice versa.

Hence using this we can eliminate the bridge. Instead we can take the following route.

Android : Java <-> JNI <-> JSI <-> Javascript.
iOS : ObjC <-> JSI <-> Javascript.

Benchmarking JSI

  1. RN version: 0.63.4
  2. NDK Version: 22.0.x
  3. CMake Version: 3.10.x
  4. Test Device : Samsung S10

Operations

  1. Get String from KV store:
    1. Android Shared Prefs over JSI
    2. Async Storage
    3. Android Shared Pref over Bridge
  2. Retrieve a Java String
    1. JSI
    2. Bridge
  3. Retrieve a Java Object
    1. JSI
    2. Bridge
  4. Query 100 Rows from Table
    1. JSI
    2. Bridge

Results:

  1. Get a JSON string of 212148 characters from KV Store

    1. JSI (Async - Spawn a thread on Java)= ~ 5 MS (Min 2 MS - Max 8 MS)
    2. JSI (Sync)= ~ 2 MS (Min 1 MS - Max 3 MS)
    3. Async Storage = ~ 22 MS (Min 12 - Max 35 MS))
    4. Bridge = ~ 14 MS (Min 8 MS - Max 20 MS)
  2. Get a Java String to JS through JNI and JSI

    1. JSI = <= 1 MS (Min 0 MS - Max 1 MS)
    2. Bridge = ~ 8 MS (Min 6 MS - Max 15 MS)
  3. Get a Java Object (Two String properties) to JS through JNI and JSI

    1. JSI = <= 1 MS (Min 0 MS - Max 1 MS)
    2. Bridge = ~ 14 MS (Min 10 MS - Max 18 MS)
  4. Query 100 rows of students in a class table - (Query time is ~ 5-10 MS)

    1. JSI = ~ 15 MS (Min 10 MS - Max 20 MS ) - Cursor iteration on Java.
    2. JSI = ~ 22 MS (Min 15 MS - Max 30 MS) - Cursor iteration on JS.
    3. Bridge = ~ 45 MS (Min 30 MS - Max 60 MS)

License

MIT

You might also like...
Android validation library which helps developer boil down the tedious work to three easy steps.
Android validation library which helps developer boil down the tedious work to three easy steps.

AwesomeValidation Introduction Implement validation for Android within only 3 steps. Developers should focus on their awesome code, and let the librar

📄The reliable, generic, fast and flexible logging framework for Android
📄The reliable, generic, fast and flexible logging framework for Android

logback-android v2.0.0 Overview logback-android brings the power of logback to Android. This library provides a highly configurable logging framework

Android framework for node.js applications

Introduction Anode is an embryonic framework for running node.js applications on Android. There are two main parts to this: a port of node.js to the A

It makes a preview from an url, grabbing all the information such as title, relevant texts and images. This a version for Android of my web link preview https://github.com/LeonardoCardoso/Link-Preview
It makes a preview from an url, grabbing all the information such as title, relevant texts and images. This a version for Android of my web link preview https://github.com/LeonardoCardoso/Link-Preview

LeoCardz Link Preview for Android It makes a preview from an url, grabbing all the information such as title, relevant texts and images. Visual Exampl

AndroidPermissions 4.2 0.0 Java Android M was added to check Permission. but Permission check processing is so dirty.

Android Permissions Checker Android M was added to check Permission. but Permission check processing is so dirty. This Project is to be simple, Checki

A plug and play ;) android library for displaying a
A plug and play ;) android library for displaying a "rate this app" dialog

Easy Rating Dialog This lib provides a simple way to display an alert dialog for rating app. Default conditions to show: User opened the app more than

Tool for Android app development

RateMeMaybe Asks the user if (s)he wants to open the Play Store to rate your application when certain requirements are met (see below). This can and s

AudioPlayerView is an Android view that loads audio from an url and have basic playback tools.
AudioPlayerView is an Android view that loads audio from an url and have basic playback tools.

AudioPlayerView AudioPlayerView is an Android view that loads audio from an url and have basic playback tools. It makes use of the Android MediaPlayer

andle is an Android tool help you sync dependencies, sdk or build tool version.

andle andle is an Android tool to help you sync dependencies, SDK or build tool version. Installation Simple install by pip: $ sudo pip install andle

Owner
Shaik Atif
Android || iOS || React Native || Go Lang
Shaik Atif
SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.

#Scripting Layer for Android (SL4A) SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreter

Damon Kohler 2.3k Dec 23, 2022
****. Use the native and support library variants instead - https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html. An android library that makes it easy to add custom fonts to edittexts and textviews

Add to your project Add this line to your dependencies in build.gradle compile 'in.workarounds.typography:typography:0.0.8' Using the views There are

Workarounds 43 Nov 6, 2021
ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Project in Maintenance Mode Only The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enha

ZXing Project 30.5k Dec 27, 2022
RxJava binding APIs for Android's UI widgets.

RxBinding RxJava binding APIs for Android UI widgets from the platform and support libraries. Download Platform bindings: implementation 'com.jakewhar

Jake Wharton 9.7k Jan 6, 2023
A gradle plugin for getting java lambda support in java 6, 7 and android

Gradle Retrolambda Plugin This plugin will automatically build your java or android project with retrolambda, giving you lambda goodness on java 6 or

Evan Tatarka 5.3k Jan 5, 2023
A comprehensive tutorial for Android Data Binding

精通 Android Data Binding 更多干货可移步至个人主页 QQ 交流群:324112728 ,或者点击链接加入QQ群 官方虽然已经给出了教程 - Data Binding Guide (中文版 - Data Binding(数据绑定)用户指南) ,但是实践之后发现槽点实在太多,于是就

Fei Liang 2.6k Dec 6, 2022
A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.

Development in this repository is stopped. Future development continues on https://github.com/yigit/android-priority-jobqueue ========================

Path Mobile Inc Pte. Ltd. 2.4k Dec 9, 2022
An android library for displaying fps from the choreographer and percentage of time with two or more frames dropped

DEPRECATED TinyDancer is deprecated. No more development will be taking place. Check out the Google Android developer documentation for UI performance

Friendly Robot 1.9k Jan 3, 2023
Memory safer implementation of android.os.Handler

Android Weak Handler Memory safer implementation of android.os.Handler Problem Original implementation of Handler always keeps hard reference to handl

Badoo Tech 1.5k Jan 5, 2023
Android Library to help you with your runtime Permissions.

PermissionHelper Android Library to help you with your runtime Permissions. Demo Android M Watch it in action. Pre M Watch it in action. Nexus 6 (M) N

Kosh Sergani 1.2k Dec 14, 2022