mozilla / pluotsorbet

[ARCHIVED] PluotSorbet is a J2ME-compatible virtual machine written in JavaScript.
GNU General Public License v2.0
240 stars 46 forks source link

Investigate running J2ME Apps without array bounds and store checks. #1037

Open mbebenita opened 9 years ago

mbebenita commented 9 years ago

Array bounds checks and array store checks in particular can be slow. In #996 I've introduced the notion of privileged classes. The compiled code for these classes doesn't include bounds / store checks. Most applications will run correctly if array checks are ignored, so it may be interesting to investigate if we can get away with running midlets without array checks.

If disabling array checks doesn't work in the general case, we can just disable them for a set of frequently called methods / classes.

brendandahl commented 9 years ago

A quick check with disabling array bounds checks for the baseline compiler(emitCheckArrayBounds and emitCheckArrayStore) yields no performance difference: desktop:

Current times: [916.448079,1004.5241129999999,1009.3523769999999,1000.9927969999999,996.754948,983.660013,1003.10665,989.7432750000002,983.4299229999999,987.3094809999999]
Current mean : 988ms
Baseline mean: 999ms
+/-          : -12ms
%            : -1.18
INSIGNIFICANT RESULT

flame device:

Current times: [17173.950044999998,16191.989888999999,19115.165253,18169.079732,17485.350983999997,18295.730983,16388.339525,19388.154107,17105.89791,17117.772129]
Current mean : 17643ms
Baseline mean: 17609ms
+/-          : 34ms
%            : 0.20
INSIGNIFICANT RESULT
mbebenita commented 9 years ago

I tried disabling bounds checks in the SHA256 benchmark and I got a nearly 39% perf gain. This needs to be investigated further.