Skip to content

Eliminate templates from jrt_read_from_buffer_by_offset and jrt_write_to_buffer_by_offset #708

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

Closed

Conversation

rtakacs
Copy link
Contributor

@rtakacs rtakacs commented Nov 6, 2015

Refactor jrt_read_from_buffer_by_offset and jrt_write_to_buffer_by_offset to eliminate template.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]

template<typename T>
bool __attr_always_inline___

inline bool
jrt_read_from_buffer_by_offset (const uint8_t *buffer_p, /**< buffer */
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps, now it is better to move implementations of the functions from header to a module like jrt.cpp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@rtakacs rtakacs force-pushed the eliminate_template_1 branch 2 times, most recently from 1e64158 to fbdfc46 Compare November 6, 2015 14:01
…fset to eliminate template.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
@rtakacs rtakacs force-pushed the eliminate_template_1 branch from fbdfc46 to 5dd6993 Compare November 6, 2015 14:23
@ruben-ayrapetyan
Copy link
Contributor

Looks good to me

@egavrin egavrin added the parser Related to the JavaScript parser label Nov 9, 2015
@egavrin
Copy link
Contributor

egavrin commented Nov 9, 2015

@rtakacs please share performance measurements and changes in binary size.

@rtakacs
Copy link
Contributor Author

rtakacs commented Nov 18, 2015

I measured some things on a rpi2 board. The master revision was 140982e

Section Size
.text 190732 -> 190900 (-0,088)
.rodata 8168 -> 8172 (-0,04)
.bss 2363840 -> 2363904 (-0,003)

Note: the other sections are not modified.

Benchmark RSS
(+ is better)
Perf
(+ is better)
3d-cube.js 132 -> 132 (0) 3.742 -> 3.756 (-0.374)
access-binary-trees.js 88 -> 88 (0) 1.909 -> 1.938 (-1.519)
access-fannkuch.js 48 -> 48 (0) 9.812 -> 9.655 (1.6001)
access-nbody.js 64 -> 64 (0) 4.539 -> 4.534 (0.1102)
bitops-3bit-bits-in-byte.js 40 -> 40 (0) 2.672 -> 2.613 (2.2081)
bitops-bits-in-byte.js 40 -> 40 (0) 3.727 -> 3.705 (0.5903)
bitops-bitwise-and.js 36 -> 36 (0) 4.296 -> 4.235 (1.4199)
controlflow-recursive.js 220 -> 220 (0) 1.727 -> 1.75 (-1.332)
crypto-aes.js 160 -> 160 (0) 6.097 -> 6.134 (-0.607)
crypto-md5.js 208 -> 208 (0) 35.795 -> 34.686 (3.0982)
crypto-sha1.js 144 -> 144 (0) 15.531 -> 14.946 (3.7667)
date-format-tofte.js 112 -> 112 (0) 4.009 -> 4.076 (-1.671)
date-format-xparb.js 96 -> 96 (0) 2.113 -> 2.14 (-1.278)
math-cordic.js 48 -> 48 (0) 4.009 -> 4.078 (-1.721)
math-partial-sums.js 44 -> 40 (9.0909) 2.34 -> 2.34 (0)
math-spectral-norm.js 48 -> 48 (0) 2.256 -> 2.289 (-1.463)
string-base64.js 204 -> 200 (1.9608) ---
string-fasta.js 56 -> 56 (0) 5.862 -> 5.775 (1.4841)
Geometric mean: RSS reduction: 0.6375% Speed up: 0.2681%

Note: all tests ran 10 times. Tests that failed are not shown in the table.

@tilmannOSG
Copy link

The results look good. Can we get this merged?

@egavrin
Copy link
Contributor

egavrin commented Nov 26, 2015

@tilmannOSG depends on @galpeter ^_^

@ruben-ayrapetyan
Copy link
Contributor

@rtakacs, could you, please, rebase the patch to the current master?

@rtakacs
Copy link
Contributor Author

rtakacs commented Jan 14, 2016

This is done by #791 so we can close this PR.

@rtakacs rtakacs deleted the eliminate_template_1 branch January 18, 2019 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Related to the JavaScript parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants