Skip to content

Improve empty checks of ecma strings #1113

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

LaszloLango
Copy link
Contributor

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com

@LaszloLango LaszloLango added enhancement An improvement binary size Affects binary size style Related to coding style labels Jun 1, 2016
@LaszloLango
Copy link
Contributor Author

Benchmark Perf (sec)
3d-cube.js 1.808 -> 1.799 : +0.534%
3d-raytrace.js 2.019 -> 2.022 : -0.136%
access-binary-trees.js 0.857 -> 0.854 : +0.341%
access-fannkuch.js 3.917 -> 3.905 : +0.312%
access-nbody.js 2.102 -> 2.093 : +0.409%
bitops-3bit-bits-in-byte.js 0.827 -> 0.825 : +0.148%
bitops-bits-in-byte.js 1.094 -> 1.089 : +0.466%
bitops-bitwise-and.js 1.882 -> 1.834 : +2.553%
bitops-nsieve-bits.js 2.845 -> 2.857 : -0.439%
controlflow-recursive.js 0.551 -> 0.554 : -0.475%
crypto-aes.js 1.990 -> 1.977 : +0.649%
crypto-md5.js 0.991 -> 0.992 : -0.158%
crypto-sha1.js 0.925 -> 0.924 : +0.070%
date-format-tofte.js 1.476 -> 1.488 : -0.860%
date-format-xparb.js 0.650 -> 0.655 : -0.796%
math-cordic.js 2.083 -> 2.078 : +0.241%
math-partial-sums.js 1.115 -> 1.108 : +0.587%
math-spectral-norm.js 0.977 -> 0.970 : +0.782%
string-base64.js 4.924 -> 4.946 : -0.432%
string-fasta.js 2.437 -> 2.513 : -3.142%
Geometric mean: +0.038%

Binary sizes (bytes)
ed08518:167768
8d45fb7:167688

}

return false;
} /* ecma_string_is_empty */
Copy link
Member

Choose a reason for hiding this comment

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

I think you can simply write:
return (logical_exp)

@LaszloLango LaszloLango force-pushed the ecma-is-empty-ecma-string branch from 8d45fb7 to b1583c7 Compare June 2, 2016 06:45
@@ -1491,7 +1491,7 @@ ecma_builtin_json_object (ecma_object_t *obj_p, /**< the object*/
member_str_p = tmp_str_p;

/* 8.b.iii */
bool is_gap_empty = (ecma_string_get_length (context_p->gap_str_p) == 0);
bool is_gap_empty = (ecma_string_is_empty (context_p->gap_str_p));
Copy link
Member

Choose a reason for hiding this comment

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

These could be placed inside their respective ifs without an intermediate variable.

@LaszloLango LaszloLango force-pushed the ecma-is-empty-ecma-string branch from b1583c7 to 91f43b9 Compare June 6, 2016 06:47
@LaszloLango LaszloLango force-pushed the ecma-is-empty-ecma-string branch from 91f43b9 to 69435cc Compare June 16, 2016 12:31
@LaszloLango
Copy link
Contributor Author

@zherczeg, @akiss77, I've rebased to the current master. Please check.

@LaszloLango LaszloLango force-pushed the ecma-is-empty-ecma-string branch from 69435cc to f26990e Compare June 17, 2016 07:45
@zherczeg
Copy link
Member

LGTM

@dbatyai
Copy link
Member

dbatyai commented Jun 21, 2016

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary size Affects binary size enhancement An improvement style Related to coding style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants