Académique Documents
Professionnel Documents
Culture Documents
An example of this process is reading a JPEG image file into an image representation in memory, transcoding and
compressing that image, and then writing it back to JPEG or a different file format (e.g. WebP or JPEG XR and so on).
Further examples are the transformations we offer which we call
True Fidelity Image Streaming, Dynamic HTML Streaming, and Flash Application Streaming.
This process of de-serializing content to an IR, transforming the IR, and serializing the IR is identical to what compilers
do. You might be more familiar with compilers in the context of programming languages. Many optimizations follow the
same process and can be considered to be compilers. You can find such compilers at the heart of many applications,
such as a datasheet equation engine, a word processor, a database query optimizer, a network router, a web browser,
a web server, even the autocorrect in a simple chat application.
In this article Ill talk about the pros and cons of different compilation strategies and where Instart Logics approach fits
into the big picture. Since compiling programming languages is the better-known, most involved and most complex
type of compilation, Ill explain using that context.
In order to work effectively, the Optimizer and the Backend need to run through many complex algorithms, and would
significantly benefit from knowledge about:
the way users use the application
the capabilities of the devices that the program will run on
For example, if the Optimizer knows which code paths are more likely to be executed, it can order them better in the
memory to get improved cache performance. Also, if the Backend knows the type of the target device, it may be able to
use specific machine instructions that can speed up the program execution.
On the other hand, a program or application itself has typically three main phases:
1. Development time when programmers create, modify, or extend the application
2. Delivery time when the application is being delivered to users
3. Run time when the application actually runs on the users device
Different compilation strategies can be categorized based on which compilation phase is done at which application
phase. This in turn determines the pros and cons of each approach.
STATIC COMPILATION
In standard static compilers, all compiler phases happen at development time. The result of the compilation is executable
machine binary that is delivered and executed on a users machine.
As such:
Pros
Cons
Example of static compilations include the GCC, Visual Studio and LLVM compilers for languages such as C and C+
+.
Cons
Examples of JITing and virtual machines include the JVM for Java, Dalvik on Android and the .NET framework for C#, and VB.net.
Cons
Examples of dynamic scripting runtimes include JavaScript, Python, PHP, and Ruby.
Cons
The Optimizer and Backend do not run at runtime and can afford
to use more complex and time consuming algorithms.
The Backend does know about the specific device and can use
special features when available.
Examples of this approach include NGen for .NET framework on Windows, ART on Android, and Xamarin compiler for iOS.
Cons
The Backend still does not know about all possible target
devices and cannot use all possible instructions available
in all machines. Since the profile based decisions are
hard coded in the application, if over time the user
behavior changes, the application cannot adapt itself to it.
Cons
At Instart Logic, we use this approach to optimize different elements of web apps before delivering various components of
the application (HTML, images, JavaScript, etc.) to the device. In addition to the above benefits, this approach is also the
least intrusive for both our customers and their users. Developers at our customers do not need to change their
development flow and can work as usual. The end users of these customers also will not notice any change in the way they
interact with the web app. Instart Logics service constantly monitors and optimizes the applications based on user
behaviors, browser/device types, etc. Every time the customer updates the application, the optimizations automatically
restart again and get applied.
Depending on the type of optimization, the input/output formats may be the same or different. For example, in the case of
HTML Streaming, the input is the HTML page that is being served to the user. Our service monitors the contents of the
HTML pages and extracts the common parts of the page which then caches and sends it faster to users. In other words, the
service parses the HTML, creates a model of the page, modifies this model, and then generates modified HTML to be
served to the user (frontend + optimization + backend).
In the case of Image Streaming, the input format might be a bitmap which then the Instart Logic service converts to
progressive JPEG and then streams. In this case, input images are decoded, modified in the memory, and then encoded
into the proper format (again, frontend + optimization + backend).
Instart Logic's compilation strategy is cloud-based, implicitly crowd-sourced, adaptive based on data analytics and machine
learning, and targets web and mobile. When was the last time you worked on a project that touches on so many cool and
hot topics!
www.instartlogic.com/blog/