Hello. I'm creating a conversor from JVM bytecode to Dart. In fact, it works already. And now I'm trying to optimize it as much as I can in this stage.
I was generating pure JS already. And My benchmark tells me that JS version is faster.
In Dart I'm using the function N.I(a+b) ----- static int32 I(int v) { return (v & 0x7fffffff) - (v & 0x80000000); }
They both are generated from the same AST, so the structure is identical.
JTransc 0.5.16 - dart
Java 1.8.0_51 - 25.51-b03 - 1.8.0_51-b16
Benchmarking:
plain loops...24.0
left shift...73.0
right shift...76.0
right unsigned shift...79.0
call static mult...49.0
call instance mult...50.0
call instance div...141.0
instanceof classes...87.0
arraycopy int...10.0
write byte[]...41.0
write short[]...36.0
write char[]...34.0
write int[]...45.0
write float[]...43.0
write double[]...55.0
String Builder 1...66.0
String Builder 2...28.0
long arithmetic...157.0
simd mutable...41.0
simd immutable...219.0
simd mutable matrix mult...149.0
StringBuilder1...83.0
StringBuilder2...83.0
Create Instances1...2.0
Create Instances2...2.0
Create Instances with builder...256.0
Java's CRC32...462.0
jzlib's CRC32...178.0
compress java's Deflate...2882.0
compress jzlib...2945.0
---------------
JTransc 0.5.16 - js
Java 1.8.0_51 - 25.51-b03 - 1.8.0_51-b16
Benchmarking:
plain loops...9.167123
left shift...18.907874
right shift...17.907579
right unsigned shift...21.689226
call static mult...15.011354
call instance mult...14.997497
call instance div...94.273156
instanceof classes...378.080885
arraycopy int...13.711299
write byte[]...32.97181
write short[]...34.282805
write char[]...33.745643
write int[]...35.28383
write float[]...42.055787
write double[]...38.582287
String Builder 1...128.865203
String Builder 2...27.21437
long arithmetic...189.857672
simd mutable...97.261278
simd immutable...132.938952
simd mutable matrix mult...520.873637
StringBuilder1...64.82517
StringBuilder2...65.545762
Create Instances1...9.613116
Create Instances2...7.370748
Create Instances with builder...156.698057
Java's CRC32...104.484334
jzlib's CRC32...95.406556
compress java's Deflate...159.09942
compress jzlib...160.694131
Thanks in advance. And congratulations for the dart project!