Skip to content

Refactor ECMA builtin template #905

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

Conversation

akosthekiss
Copy link
Member

Avoid sorting the array of property magic string IDs and make it
const, thus ensuring that it gets placed in .rodata. Replace the
binary search in the array (which would not work anymore because
of unsortendness) with function that returns the index of the
looked-after magic string ID using a switch-based logic (we rely
on compiler optimization to generate optimal code from that
switch).

Extras:

  • Getting rid of the superfluous macro argument from routine names.
  • Fixing the list of undef'd macros
  • Fixing builtin-related comments

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

@akosthekiss
Copy link
Member Author

The effect on text (=.text+.rodata) and data (=.data) is considerable in release builds (up to cca. 2.5K gain in total), size of r/w data drops below 100 bytes. Debug builds show strange results; something is still left in .data. Details below.

filename master/text master/data pr905/text pr905/data gain/text gain/data
release.armv7lhf_linux/jerry 197295 1096 195958 52 1337 1044
release.armv7lhf_linux-cp/jerry 143284 812 142156 52 1128 760
release.armv7lhf_linux-cp_minimal/jerry 88091 192 87973 0 118 192
release.armv7lhf_linux-mem_stats/jerry 197855 1096 196554 52 1301 1044
release.armv7lhf_linux-mem_stress_test/jerry 197231 1096 195590 52 1641 1044
release.mcu_stm32f3-cp.bin/jerry 144356 260 142748 72 1608 188
release.mcu_stm32f3-cp_minimal.bin/jerry 82704 68 82436 20 268 48
release.mcu_stm32f4-cp.bin/jerry 144356 260 142748 72 1608 188
release.mcu_stm32f4-cp_minimal.bin/jerry 82704 68 82436 20 268 48
release.x64_linux/jerry 279890 1373 278590 61 1300 1312
release.x64_linux-cp/jerry 211932 989 210766 61 1166 928
release.x64_linux-cp_minimal/jerry 133068 204 132993 0 75 204
release.x64_linux-mem_stats/jerry 280923 1373 280071 61 852 1312
release.x64_linux-mem_stress_test/jerry 279917 1373 279031 61 886 1312
debug.armv7lhf_linux/jerry 732048 3272 731864 2228 184 1044
debug.armv7lhf_linux-cp/jerry 536720 2988 535624 2228 1096 760
debug.armv7lhf_linux-cp_minimal/jerry 366772 2384 366120 2192 652 192
debug.armv7lhf_linux-mem_stats/jerry 735596 3272 735364 2228 232 1044
debug.armv7lhf_linux-mem_stress_test/jerry 732096 3272 731912 2228 184 1044
debug.mcu_stm32f4-cp.bin/jerry 547060 2484 545060 2244 2000 240
debug.mcu_stm32f4-cp_minimal.bin/jerry 365828 2272 365244 2212 584 60
debug.x64_linux/jerry 808414 5780 812955 4468 -4541 1312
debug.x64_linux-cp/jerry 628393 5492 630807 4468 -2414 1024
debug.x64_linux-cp_minimal/jerry 438533 4688 439054 4432 -521 256
debug.x64_linux-mem_stats/jerry 813019 5780 816760 4468 -3741 1312
debug.x64_linux-mem_stress_test/jerry 808434 5780 812975 4468 -4541 1312

@akosthekiss akosthekiss added enhancement An improvement memory consumption Affects memory consumption ecma builtins Related to ECMA built-in routines labels Feb 20, 2016
* false - list all properties into
* main collection.
*/
bool separate_enumerable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comment for this argument

@LaszloLango
Copy link
Contributor

Could you measure the performance on RPi2?

@zherczeg
Copy link
Member

If there is no big perf regression, LGTM from my side.

@akosthekiss akosthekiss force-pushed the ecma-builtin-template-refactor branch from 7ab6225 to a308dd1 Compare February 22, 2016 10:02
@akosthekiss
Copy link
Member Author

@LaszloLango I've updated the patch. Does it look better?

@LaszloLango
Copy link
Contributor

@akiss77, yes. The patch looks good. I agree with @zherczeg. If there is no big perf regression then we can merge the PR.

@bzsolt
Copy link
Member

bzsolt commented Feb 22, 2016

RPi2 results
master (aa0b621)

                  Benchmark |                  Perf(+ is better)
                 3d-cube.js |  2.622s ->   2.640s :  -0.699%  (+-0.735%) : [≈]
     access-binary-trees.js |  1.407s ->   1.412s :  -0.355%  (+-1.301%) : [≈]
         access-fannkuch.js |  7.983s ->   7.995s :  -0.146%  (+-0.421%) : [≈]
            access-nbody.js |  3.102s ->   3.098s :  +0.108%  (+-0.939%) : [≈]
bitops-3bit-bits-in-byte.js |  1.733s ->   1.735s :  -0.096%  (+-0.715%) : [≈]
     bitops-bits-in-byte.js |  2.660s ->   2.655s :  +0.188%  (+-0.757%) : [≈]
      bitops-bitwise-and.js |  3.645s ->   3.685s :  -1.097%  (+-0.835%) : [-]
   controlflow-recursive.js |  0.890s ->   0.890s :  +0.000%  (+-0.000%) : [≈]
              crypto-aes.js |  4.640s ->   4.718s :  -1.688%  (+-0.654%) : [-]
              crypto-md5.js | 21.462s ->  21.540s :  -0.365%  (+-0.756%) : [≈]
             crypto-sha1.js |  9.752s ->   9.715s :  +0.376%  (+-0.649%) : [≈]
       date-format-tofte.js |  2.215s ->   2.230s :  -0.677%  (+-0.781%) : [≈]
       date-format-xparb.js |  1.065s ->   1.087s :  -2.035%  (+-1.176%) : [-]
             math-cordic.js |  3.010s ->   3.000s :  +0.332%  (+-0.597%) : [≈]
       math-partial-sums.js |  1.667s ->   1.660s :  +0.400%  (+-0.508%) : [≈]
      math-spectral-norm.js |  1.485s ->   1.513s :  -1.908%  (+-1.096%) : [-]
            string-fasta.js |  4.567s ->   4.565s :  +0.037%  (+-1.171%) : [≈]
            Geometric mean: |               Speed up: -0.446% (+-0.200%) : [-]

@LaszloLango
Copy link
Contributor

@bzsolt, thanks for the measurement. @akiss77, you may land the patch.

@zherczeg
Copy link
Member

Just noise. LGTM

Avoid sorting the array of property magic string IDs and make it
const, thus ensuring that it gets placed in .rodata. Replace the
binary search in the array (which would not work anymore because
of unsortendness) with function that returns the index of the
looked-after magic string ID using a switch-based logic (we rely
on compiler optimization to generate optimal code from that
switch).

Extras:
* Getting rid of the superfluous macro argument from routine names.
* Fixing the list of undef'd macros
* Fixing related comments

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
@akosthekiss akosthekiss force-pushed the ecma-builtin-template-refactor branch from a308dd1 to 235a5b1 Compare February 22, 2016 12:48
@akosthekiss akosthekiss merged commit 235a5b1 into jerryscript-project:master Feb 22, 2016
@akosthekiss akosthekiss deleted the ecma-builtin-template-refactor branch February 22, 2016 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ecma builtins Related to ECMA built-in routines enhancement An improvement memory consumption Affects memory consumption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants