Change Java to use array indexes instead of methods
Method invocations are not entirely free on Android. Change the generated Java code to use the same array-based approach used in JS and C to compute dimensions, positions, etc instead of relying too heavily on method invovations. As a bonus, the Java transpiler becomes a lot simpler because the code is more analogous to the C counterpart. In my local benchmarks this change gives us a major performance boost on Android (between 15% and 30%) depending on the device and the runtime (Dalvik|Art).
This commit is contained in:
@@ -261,6 +261,7 @@ function transpileAnnotatedJStoC(jsCode) {
|
||||
.replace(/node\./g, 'node->')
|
||||
.replace(/child\./g, 'child->')
|
||||
.replace(/parent\./g, 'parent->')
|
||||
.replace(/var\/\*\(c\)!([^*]+)\*\//g, '$1')
|
||||
.replace(/var\/\*([^\/]+)\*\//g, '$1')
|
||||
.replace(/ === /g, ' == ')
|
||||
.replace(/ !== /g, ' != ')
|
||||
|
Reference in New Issue
Block a user