EXIficient for JavaScript

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Categories

Categories

JavaScript Languages
GroupId

GroupId

com.siemens.ct.exi
ArtifactId

ArtifactId

exificient-for-javascript
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

EXIficient for JavaScript
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Source Code Management

Source Code Management

https://github.com/EXIficient/exificient-for-javascript

Download exificient-for-javascript

How to add to project

<!-- https://jarcasting.com/artifacts/com.siemens.ct.exi/exificient-for-javascript/ -->
<dependency>
    <groupId>com.siemens.ct.exi</groupId>
    <artifactId>exificient-for-javascript</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.siemens.ct.exi/exificient-for-javascript/
implementation 'com.siemens.ct.exi:exificient-for-javascript:1.0.4'
// https://jarcasting.com/artifacts/com.siemens.ct.exi/exificient-for-javascript/
implementation ("com.siemens.ct.exi:exificient-for-javascript:1.0.4")
'com.siemens.ct.exi:exificient-for-javascript:jar:1.0.4'
<dependency org="com.siemens.ct.exi" name="exificient-for-javascript" rev="1.0.4">
  <artifact name="exificient-for-javascript" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.siemens.ct.exi', module='exificient-for-javascript', version='1.0.4')
)
libraryDependencies += "com.siemens.ct.exi" % "exificient-for-javascript" % "1.0.4"
[com.siemens.ct.exi/exificient-for-javascript "1.0.4"]

Dependencies

compile (2)

Group / Artifact Type Version
org.glassfish : javax.json jar 1.0.4
com.siemens.ct.exi : exificient jar 1.0.4

test (4)

Group / Artifact Type Version
junit : junit jar 4.11
org.skyscreamer : jsonassert jar 1.2.3
net.javacrumbs.json-unit : json-unit jar 1.16.0
com.google.code.gson : gson jar 2.7

Project Modules

There are no modules declared in this project.

exificient-for-javascript

EXI for JavaScript (Explorative) - How EXI can be used to represent JavaScript efficiently w.r.t.

  • Size and
  • Processing speed

Implementations:

Build Status

Abstract Syntax Tree (AST) for JavaScript

We re-use the syntax tree format as standardized by EStree project. See also

Sample

JavaScript

var dog = 6, cat = 7, pig = dog * cat;

EXI for JavaScript (visualized as XML)

<Program>
    <body>
        <array>
            <VariableDeclaration>
                <declarations>
                    <array>
                        <VariableDeclarator>
                            <id>
                                <Identifier>
                                    <name>dog</name>
                                </Identifier>
                            </id>
                            <init>
                                <Literal>
                                    <value>
                                        <integer>6</integer>
                                    </value>
                                </Literal>
                            </init>
                        </VariableDeclarator>
                    </array>
                </declarations>
                <kind>var</kind>
            </VariableDeclaration>
            <VariableDeclaration>
                <declarations>
                    <array>
                        <VariableDeclarator>
                            <id>
                                <Identifier>
                                    <name>cat</name>
                                </Identifier>
                            </id>
                            <init>
                                <Literal>
                                    <value>
                                        <integer>7</integer>
                                    </value>
                                </Literal>
                            </init>
                        </VariableDeclarator>
                    </array>
                </declarations>
                <kind>var</kind>
            </VariableDeclaration>
            <VariableDeclaration>
                <declarations>
                    <array>
                        <VariableDeclarator>
                            <id>
                                <Identifier>
                                    <name>pig</name>
                                </Identifier>
                            </id>
                            <init>
                                <BinaryExpression>
                                    <operator>*</operator>
                                    <left>
                                        <Identifier>
                                            <name>dog</name>
                                        </Identifier>
                                    </left>
                                    <right>
                                        <Identifier>
                                            <name>cat</name>
                                        </Identifier>
                                    </right>
                                </BinaryExpression>
                            </init>
                        </VariableDeclarator>
                    </array>
                </declarations>
                <kind>var</kind>
            </VariableDeclaration>
        </array>
    </body>
</Program>

Early Results

See test-data in https://github.com/EXIficient/exificient-for-javascript/tree/master/src/test/resources.

Compression

TestCase JavaScript [Size in Bytes] EXI 4 JS [Size in Bytes]
angular2.js 1182582 388994
angular2.min.js 635809 375410
animals.js 40 30
browserDetection.js 885 316
jquery.js 263767 72755
jquery.min.js 86355 58250
react.js 701412 200306
react.min.js 148805 101384
xCryptic.app.js 5611 2508

On average "EXI for JS" is about 50% of the original JavaScript filesize!

Compression Figure

com.siemens.ct.exi

Versions

Version
1.0.4
1.0.1
1.0.0
0.9.7