Skip to content

refactor rcs_chunked_list and remove its c++ features #806

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

jiangzidong
Copy link
Contributor

remove rcs_chunked_list 's c++ features. All the functionality remain the same

It can pass the make precommit.

in x86 machine (32bit)
size -A release_jerry output

section master patch
.note.gnu.build-id 36 36
.text 253351 1253191
.rodata 13564 13596
.eh_frame 26464 26036
.init_array 4 0
.data 1096 1096
.bss 2363776 2363776
.comment 41 41
Total 2658332 2657772

@jiangzidong
Copy link
Contributor Author

performance in x86 machine. remain same

Benchmark RSS
(+ is better)
Perf
(+ is better)
3d-cube.js 116-> 116 (0.000) 0.284-> 0.288 (-1.408)
access-binary-trees.js 84-> 84 (0.000) 0.16-> 0.164 (-2.500)
access-fannkuch.js 44-> 44 (0.000) 0.836->0.8368 (-0.096)
bitops-3bit-bits-in-byte.js 32-> 32 (0.000) 0.236-> 0.236 (0.000)
bitops-bits-in-byte.js 32-> 32 (0.000) 0.2936-> 0.288 (1.907)
bitops-bitwise-and.js 36-> 36 (0.000) 0.292-> 0.292 (0.000)
controlflow-recursive.js 240-> 240 (0.000) 0.144-> 0.14 (2.778)
crypto-aes.js 124-> 124 (0.000) 0.528->0.5296 (-0.303)
crypto-md5.js 188-> 188 (0.000) 2.4352-> 2.464 (-1.183)
crypto-sha1.js 136-> 136 (0.000) 1.124-> 1.136 (-1.068)
date-format-tofte.js 76-> 76 (0.000) 0.296-> 0.292 (1.351)
date-format-xparb.js 72-> 72 (0.000) 0.156-> 0.148 (5.128)
math-cordic.js 40-> 40 (0.000) 0.32-> 0.316 (1.250)
math-spectral-norm.js 40-> 40 (0.000) 0.192-> 0.192 (0.000)
string-base64.js 168-> 168 (0.000) 28.6832->29.3656 (-2.379)
string-fasta.js 52-> 52 (0.000) 0.5776->0.5832 (-0.970)
Geometric mean: RSS reduction: 0% Speed up: 0.1752%

@rtakacs
Copy link
Contributor

rtakacs commented Jan 18, 2016

Could you please repeat these measurements on an ARM board? (The best would be on an RPI2)

@rtakacs
Copy link
Contributor

rtakacs commented Jan 18, 2016

I've already started work on this topic (#791 (comment)) and I have a not-yet-published patch very similar to yours, but I intended to keep it private until all the code size increase issues I've experienced are solved.

To reduce the chance of duplicating work: I've also been working on the refactoring of the operand class in the parser.

@zherczeg
Copy link
Member

Yes I agree to avoid work duplication. I think you should discuss how to share the work. Perhaps a good topic for Gitter :)

@jiangzidong
Copy link
Contributor Author

measure on RPI2, @rtakacs is the data similar with yours?

Benchmark RSS
(+ is better)
Perf
(+ is better)
3d-cube.js 112-> 112 (0.000) 2.97-> 2.99 (-0.673)
access-binary-trees.js 84-> 80 (4.762) 1.84667-> 1.82 (1.444)
access-fannkuch.js 40-> 36 (10.000) 8.67->9.00333 (-3.845)
bitops-3bit-bits-in-byte.js 32-> 32 (0.000) 2.22333->2.23667 (-0.600)
bitops-bits-in-byte.js 32-> 32 (0.000) 2.99-> 2.99 (0.000)
bitops-bitwise-and.js 32-> 32 (0.000) 3.44-> 3.61 (-4.942)
controlflow-recursive.js 220-> 220 (0.000) 1.53667->1.55667 (-1.302)
crypto-aes.js 124-> 120 (3.226) 5.14667->5.21667 (-1.360)
crypto-md5.js 184-> 184 (0.000) 24.3367->24.4133 (-0.315)
crypto-sha1.js 132-> 136 (-3.030) 11.22->11.1833 (0.327)
date-format-tofte.js 72-> 72 (0.000) 3.19333->3.21333 (-0.626)
date-format-xparb.js 76-> 80 (-5.263) 1.65667->1.63667 (1.207)
math-cordic.js 40-> 36 (10.000) 3.27-> 3.29 (-0.612)
math-spectral-norm.js 40-> 36 (10.000) 2.05333-> 2.05 (0.162)
string-fasta.js 48-> 48 (0.000) 5.29333->5.37667 (-1.574)
Geometric mean: RSS reduction: 1.9588% Speed up: -0.834%
section master patch
.note.gnu.build-id 36 36
.text 189192 188320
.rodata 8284 8336
.ARM.exidx 8 8
.init_array 4 0
.data 1096 1096
.bss 2363776 2363776
.comment 43 43
.ARM.attributes 51 51
Total 2562490 2561666

binary size:
master 198K
patch 194K

@zherczeg
Copy link
Member

So this is actually a size reduction! Great!

@jiangzidong
Copy link
Contributor Author

@zherczeg Do you mean the RSS result? I don't know why the rss will change in RPI2. In x86 machine, it is exactly same after the refactor.

@rtakacs
Copy link
Contributor

rtakacs commented Jan 18, 2016

@jiangzidong: My last measurement with my patch was at the end of December. The code size was a bit bigger than yours, but the performance test results were similar to yours.

JERRY_ASSERT (node_p != NULL);

MEM_CP_SET_POINTER (node_p->prev_cp, prev_node_p);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually, we place comment with function name after closing bracket, related to the function.
In the case, the line should be the following: } /* rcs_chunked_list_set_prev */.

@ruben-ayrapetyan ruben-ayrapetyan added enhancement An improvement normal memory management Related to memory management or garbage collection labels Jan 19, 2016
jiangzidong added a commit to jiangzidong/jerryscript that referenced this pull request Jan 19, 2016
@jiangzidong
Copy link
Contributor Author

@ruben-ayrapetyan Thanks, I fixed as you commented.

@ruben-ayrapetyan
Copy link
Contributor

Looks good to me

@rtakacs
Copy link
Contributor

rtakacs commented Jan 29, 2016

LGTM, but I'm not a reviewer.

@zherczeg
Copy link
Member

LGTM

@rtakacs
Copy link
Contributor

rtakacs commented Feb 3, 2016

@jiangzidong: I'm compiling the project with a standard C compiler and fixing the remaining little C++ features. Before we land this patch, please add a 'typedef' to the rcs_chunked_list_t struct to use it as a type.

@jiangzidong
Copy link
Contributor Author

@rtakacs: updated. sorry for the mistake

@rtakacs
Copy link
Contributor

rtakacs commented Feb 5, 2016

@jiangzidong Thanks for the update. The fix looks good to me.

LaszloLango pushed a commit that referenced this pull request Feb 5, 2016
issue #806

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang [email protected]
@LaszloLango
Copy link
Contributor

Landed (dfb22c3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement memory management Related to memory management or garbage collection normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants