Skip to content

Optimize uint32 hash computation. #1107

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

Merged
merged 1 commit into from
Jun 1, 2016

Conversation

zherczeg
Copy link
Member

Small optimization, only positive improvements:

Benchmark Perf (sec)
3d-cube.js 1.801 -> 1.761 : +2.195%
3d-raytrace.js 1.998 -> 1.962 : +1.810%
access-binary-trees.js 0.865 -> 0.867 : -0.307%
access-fannkuch.js 3.888 -> 3.765 : +3.159%
access-nbody.js 2.082 -> 2.078 : +0.182%
bitops-3bit-bits-in-byte.js 0.834 -> 0.832 : +0.154%
bitops-bits-in-byte.js 1.100 -> 1.100 : -0.022%
bitops-bitwise-and.js 1.874 -> 1.873 : +0.028%
bitops-nsieve-bits.js 2.845 -> 2.732 : +3.955%
controlflow-recursive.js 0.562 -> 0.561 : +0.086%
crypto-aes.js 1.981 -> 1.917 : +3.197%
crypto-md5.js 0.996 -> 0.988 : +0.760%
crypto-sha1.js 0.930 -> 0.918 : +1.312%
date-format-tofte.js 1.472 -> 1.437 : +2.355%
date-format-xparb.js 0.652 -> 0.653 : -0.100%
math-cordic.js 2.086 -> 2.071 : +0.732%
math-partial-sums.js 1.110 -> 1.110 : -0.025%
math-spectral-norm.js 0.975 -> 0.955 : +2.112%
string-base64.js 4.931 -> 4.914 : +0.345%
string-fasta.js 2.440 -> 2.363 : +3.163%
Geometric mean: +1.264%

Binary sizes (bytes)
old:167976
new:167960

@LaszloLango LaszloLango added enhancement An improvement performance Affects performance labels Jun 1, 2016
*buf_p = (lit_utf8_byte_t) ((value % 10) + LIT_CHAR_0);
value /= 10;
}
while (value != 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

This loop is the same as used in ecma_uint32_to_utf8_string. Wouldn't be better if we made that function always inline?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, because that function is called from several places, and only this one is time critical. The memmove part is also not needed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Only a few. You eliminated one, so 2 call remains after this PR.

@LaszloLango
Copy link
Contributor

LGTM

1 similar comment
@dbatyai
Copy link
Member

dbatyai commented Jun 1, 2016

LGTM

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
@zherczeg zherczeg force-pushed the uint32_index_opt branch from 6b99419 to a5d9701 Compare June 1, 2016 12:14
@zherczeg zherczeg merged commit a5d9701 into jerryscript-project:master Jun 1, 2016
@zherczeg zherczeg deleted the uint32_index_opt branch June 1, 2016 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement performance Affects performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants