New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrink the binary size #13

Closed
gliechtenstein opened this Issue Dec 19, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@gliechtenstein
Contributor

gliechtenstein commented Dec 19, 2016

The reason it's huge is because of a library that's used to process the JSON template--the end result contains one binary for every possible Android device type.

Find another library that's much smaller and don't have this problem.

@hakimihamdan88

This comment has been minimized.

hakimihamdan88 commented Dec 20, 2016

the apk file quite big

@wallabyway

This comment has been minimized.

wallabyway commented Dec 22, 2016

consider using gles.js js runtime...
3MB - https://github.com/borisvanschooten/glesjs/tree/master/libs/armeabi

It's a 3MB uncompressed file, compared to liquidPlayer's 22Mb file...

22MB - https://github.com/LiquidPlayer/LiquidCore/blob/master/LiquidCoreAndroid/jni/lib/armeabi-v7a/libnode.so)

@gliechtenstein

This comment has been minimized.

Contributor

gliechtenstein commented Dec 22, 2016

@wallabyway wow 3MB sounds great! But I just took a look and not sure if this is a full fledged javascript engine or a specialized engine for dealing with WebGL only. According to the repo:

Gles.js provides Android WebGL bindings for the Javascript V8 engine

Also,

The goal is not to provide a complete Web browser environment, but just a no-frills direct WebGL canvas, similar to what Ejecta does for IOS.

p.s.
We are definitely moving away from the LiquidCore based engine. In fact I've been experimenting with a couple of other engines last couple of days, and have some promising results. Let me know if I'm missing something about this Gles.js. If it's the right alternative I will definitely try it and consider this.

@wallabyway

This comment has been minimized.

wallabyway commented Dec 23, 2016

The lib file is regular v8 engine. It's specific to arm hence it's small size. Use it as you would regular v8 and ignore any additional webgl bindings (which are external to the .so file anyway).

example apk demos here: http://tmtg.net/glesjs/

gles.js is simply v8 with call outs to OpenGL calls (bindings) and a fake xhr request routing to local android file system files. A small js shim script file is executed first, inside v8 to fake DOM/canvas and regular webGL api. This reduces the effort to port your normal webgl browser code, into gles.js thanks to this shim file.

To quote from the author:
"the Javascript V8 engine (ARMv7 architecture). WebGL is directly translated to OpenGL ES, providing what is probably the fastest and smallest engine for running HTML5 games currently available on Android. APK footprint is about 1.5 Mb"

Use the existing libglesjs.so file in the gles project, and follow the example gles cpp/jni code on how to initialize, runScript() / ie. parser()

@gliechtenstein

This comment has been minimized.

Contributor

gliechtenstein commented Jan 2, 2017

Alright guys, starting off 2017 with a slimmer Jasonette!

We switched out the JS engine and now the entire APK size is at 10MB! That's over 75% smaller than before! https://twitter.com/jasonclient/status/815919678409347072

Here's the related PR #42

We took some time to make sure this works for not just the core JSON parser but also other JS files we've been using, including the CSV parser and the RSS parser, thanks to @brad

There is room for making it even smaller (By splitting binary/giving up on x86) but for now I think 10MB is good enough. If anyone wants to look further into this you're welcome to do so though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment