First, we write the shared code in Kotlin. For Android, it gets converted to the Java bytecode that can be executed in the JVM. So, Android already has a Virtual Machine(VM) that is easily capable of running it.
But what about iOS, how can it run Kotlin? Can we do it without the Virtual Machine(VM)? Have you ever wondered how it works?
For iOS, Kotlin code must be converted to the source code(native code executable on iOS) that goes inside the framework. That source code works on iOS.
How does the Kotlin code get converted to the source code that is capable of running on iOS?
Here comes the Kotlin Compiler into the picture. It has two parts as follows:
1. Frontend - It converts the Kotlin Code into the IR (Intermediate Representation). That IR is capable of getting converted into the native code that is machine-executable using the backend which is described below.
2. Backend - It converts the IR into the native code that is machine-executable. This is possible because of the Kotlin/Native Infrastructure built by JetBrains.For Android, it converts the IR to Java Bytecode and for iOS, it converts IR to the iOS native machine-executable code.
It is important to note that we are able to run the shared business logic code written in Kotlin on a platform like iOS without the Virtual Machine(VM).
Here, Kotlin/Native plays an important role. What exactly is Kotlin/Native?
From the official documentation:
Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.
It is designed to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS or embedded targets), or where a developer is willing to produce a reasonably-sized self-contained program without the need to ship an additional execution runtime.
Now, the next question arises in our mind, what is LLVM?
We can say that LLVM is a library for programmatically creating the machine native code from the Intermediate Representation(IR).
We first create the Intermediate Representation(IR) which is needed by the LLVM and then LLVM does its magic.
Both voice and video calls depend on how we stream media between the two clients who are connected to each other. So, there must be something that can do the work of media streaming from one client to another client.
For media streaming, we need to know about WebRTC.
WebRTC is a free, open project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.
Feature engineering is the process of using domain knowledge of the data to create features that make machine learning algorithms work.
If feature engineering is done correctly, it increases the predictive power of machine learning algorithms by creating features from raw data that help facilitate the machine learning process.
The main reason for the low-performance Android App is that it runs GC very frequently.
Simple in one line: The time for which GC is running the actual app is not running.
When the app runs, it allocates many objects on the basis of your code, and when the objects are no longer referred to, the system call GC when there is memory pressure to deallocate those objects, so if the object allocation and deallocation are occurring on regular basis.
Both voice and video calls depend on how we stream media between the two clients which are connected to each other. So, there must be something that can do the work of media streaming from one client to another client.
For media streaming, we need to know about WebRTC.
WebRTC is a free, open project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.