jerryscript
jerryscript copied to clipboard
Rework internal methods
- Created virtual function tables for internal methods and call the specialized internal function for the object instead of the generic one which operates based on a switch by the object type
- Generalize ecma_property_descriptor_t to handle virtual and general properties
- Separate the new virtual internal methods into the corresponding .c file
Co-authored-by: Robert Fancsik [email protected] JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi [email protected]
benchmark test on RPI2:
var a = [];
a.length = 11000;
for (var i = 0; i < 10000; i++) {
a[i] = i;
}
for (var i = 0; i < 5000; i++) {
a.reverse();
a.reverse();
a.reverse();
a.reverse();
a.reverse();
a.reverse();
a.reverse();
a.reverse();
a.reverse();
a.reverse();
}
Before: 4m30s After this PR: 4m3s (10% gain)
Benchmark | Heap (bytes) | Stack (bytes) | Perf (sec) |
---|---|---|---|
0b1100oclock.js | 7648 -> 7648 : 0.000% | 1656 -> 1656 : 0.000% | 0.279 -> 0.292 : -4.625% |
3d-cube.js | 10992 -> 10992 : 0.000% | 14280 -> 11616 : +18.655% | 1.090 -> 1.094 : -0.324% |
3d-morph.js | 289248 -> 289248 : 0.000% | 1664 -> 1664 : 0.000% | 1.321 -> 1.313 : +0.607% |
3d-raytrace.js | 119456 -> 119456 : 0.000% | 2572 -> 2220 : +13.686% | 1.287 -> 1.295 : -0.669% |
FitbitOS-Really-Basic.js | 2048 -> 2048 : 0.000% | 1592 -> 1592 : 0.000% | 0.557 -> 0.562 : -0.751% |
Flashlight-App-for-FitBit-Ionic.js | 7160 -> 7160 : 0.000% | 2128 -> 2128 : 0.000% | 0.991 -> 0.987 : +0.393% |
access-binary-trees.js | 27120 -> 27120 : 0.000% | 3548 -> 3028 : +14.656% | 0.770 -> 0.704 : +8.489% |
access-fannkuch.js | 1816 -> 1816 : 0.000% | 1736 -> 1736 : 0.000% | 2.571 -> 2.585 : -0.519% |
access-nbody.js | 4592 -> 4592 : 0.000% | 1824 -> 1824 : 0.000% | 1.462 -> 1.465 : -0.178% |
bitops-3bit-bits-in-byte.js | 1048 -> 1048 : 0.000% | 1680 -> 1680 : 0.000% | 0.688 -> 0.689 : -0.248% |
bitops-bits-in-byte.js | 1008 -> 1008 : 0.000% | 1680 -> 1680 : 0.000% | 0.997 -> 0.983 : +1.409% |
bitops-bitwise-and.js | 784 -> 784 : 0.000% | 1376 -> 1376 : 0.000% | 1.259 -> 1.364 : -8.339% |
bitops-nsieve-bits.js | 61208 -> 61208 : 0.000% | 1680 -> 1680 : 0.000% | 1.492 -> 1.483 : +0.601% |
controlflow-recursive.js | 1288 -> 1288 : 0.000% | 61584 -> 49344 : +19.875% | 0.527 -> 0.490 : +7.076% |
crypto-aes.js | 28144 -> 28144 : 0.000% | 2308 -> 2256 : +2.253% | 0.884 -> 0.888 : -0.458% |
crypto-md5.js | 70896 -> 70896 : 0.000% | 1764 -> 1764 : 0.000% | 0.729 -> 0.712 : +2.317% |
crypto-sha1.js | 46240 -> 46240 : 0.000% | 1808 -> 1808 : 0.000% | 0.750 -> 0.734 : +2.246% |
crypto.js | 50112 -> 50112 : 0.000% | 3200 -> 2744 : +14.250% | 8.457 -> 8.422 : +0.417% |
date-format-tofte.js | 8840 -> 8840 : 0.000% | 2136 -> 2136 : 0.000% | 0.989 -> 0.974 : +1.523% |
date-format-xparb.js | 15200 -> 15200 : 0.000% | 2664 -> 2512 : +5.706% | 0.722 -> 0.740 : -2.567% |
deltablue.js | 456312 -> 456312 : 0.000% | 3592 -> 3080 : +14.254% | 5.278 -> 5.257 : +0.398% |
fibit-yoga-app.js | 6136 -> 6136 : 0.000% | 2744 -> 2744 : 0.000% | 2.057 -> 1.972 : +4.124% |
fitbit-week-number.js | 1544 -> 1544 : 0.000% | 1744 -> 1744 : 0.000% | 0.354 -> 0.358 : -1.080% |
ionic-watchface-borderlands.js | 8720 -> 8720 : 0.000% | 1796 -> 1796 : 0.000% | 2.009 -> 2.037 : -1.406% |
jacadi.js | 4088 -> 4088 : 0.000% | 7868 -> 6316 : +19.725% | 1.560 -> 1.560 : +0.016% |
math-cordic.js | 2064 -> 2064 : 0.000% | 1680 -> 1680 : 0.000% | 1.668 -> 1.659 : +0.553% |
math-partial-sums.js | 1528 -> 1528 : 0.000% | 1656 -> 1656 : 0.000% | 1.188 -> 1.156 : +2.651% |
math-spectral-norm.js | 3248 -> 3248 : 0.000% | 1680 -> 1680 : 0.000% | 0.762 -> 0.741 : +2.847% |
raytrace.js | 22008 -> 22008 : 0.000% | 5168 -> 4512 : +12.693% | 2.654 -> 2.703 : -1.862% |
richards.js | 8472 -> 8472 : 0.000% | 2156 -> 1896 : +12.059% | 0.297 -> 0.298 : -0.350% |
sdk-altimeter.js | 1632 -> 1632 : 0.000% | 1824 -> 1824 : 0.000% | 2.249 -> 2.277 : -1.216% |
sdk-hr-meter.js | 1688 -> 1688 : 0.000% | 1796 -> 1796 : 0.000% | 0.223 -> 0.229 : -2.474% |
sdk-lcd-clock.js | 5624 -> 5624 : 0.000% | 2152 -> 2152 : 0.000% | 1.530 -> 1.548 : -1.139% |
string-base64.js | 90120 -> 90120 : 0.000% | 1728 -> 1728 : 0.000% | 1.423 -> 1.418 : +0.333% |
string-fasta.js | 4400 -> 4400 : 0.000% | 1664 -> 1664 : 0.000% | 2.837 -> 2.550 : +10.113% |
Geometric mean: | 8680.535 -> 8680.535 : 0.000% | 2466.993 -> 2356.301 : +4.487% | 1.13 -> 1.124 : +0.531% |
Binary (bytes) | master(79fd540ec9) | patch(5ac777e7d1) | Diff |
---|---|---|---|
size | 239228 | 243324 | +4096 bytes |
.rodata | 20950 | 21920 | +970 bytes |
.dynstr | 384 | 384 | 0 bytes |
.rel.plt | 384 | 384 | 0 bytes |
.interp | 25 | 25 | 0 bytes |
.dynsym | 864 | 864 | 0 bytes |
.gnu.hash | 428 | 428 | 0 bytes |
.text | 208744 | 214240 | +5496 bytes |
.comment | 85 | 85 | 0 bytes |
.shstrtab | 226 | 226 | 0 bytes |
.data | 8 | 8 | 0 bytes |
.ARM.exidx | 8 | 8 | 0 bytes |
.rel.dyn | 16 | 16 | 0 bytes |
.init | 12 | 12 | 0 bytes |
.got | 208 | 208 | 0 bytes |
.plt | 608 | 608 | 0 bytes |
.note.ABI-tag | 32 | 32 | 0 bytes |
.gnu.version_r | 64 | 64 | 0 bytes |
.bss | 1575136 | 1575136 | 0 bytes |
.fini | 8 | 8 | 0 bytes |
.hash | 372 | 372 | 0 bytes |
.gnu.version | 108 | 108 | 0 bytes |
.fini_array | 4 | 4 | 0 bytes |
.init_array | 4 | 4 | 0 bytes |
.dynamic | 248 | 248 | 0 bytes |
.eh_frame | 4 | 4 | 0 bytes |
.ARM.attributes | 53 | 53 | 0 bytes |