Skip to content

Optimize 'lit_get_magic_string_size' calls #893

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

Calculate magic string sizes in compile time.

JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]

@LaszloLango LaszloLango added enhancement An improvement performance Affects performance labels Feb 17, 2016
@LaszloLango
Copy link
Contributor Author

RPi2 results:
base rev: b2f3ec2

Benchmark RSS
(+ is better)
Perf
(+ is better)
3d-cube.js   84k ->   84k      
             +0.000%
  2.730s ->   2.690s                      
                 +1.465%  (+-0.927%) : [+]
access-binary-trees.js   72k ->   72k      
             +0.000%
  1.453s ->   1.430s                      
                 +1.605%  (+-0.576%) : [+]
access-fannkuch.js   28k ->   28k      
             +0.000%
  8.162s ->   7.925s                      
                 +2.900%  (+-0.695%) : [+]
access-nbody.js   36k ->   36k      
             +0.000%
  3.190s ->   3.193s                      
                 -0.104%  (+-0.421%) : [≈]
bitops-3bit-bits-in-byte.js   24k ->   24k      
             +0.000%
  1.767s ->   1.760s                      
                 +0.378%  (+-0.479%) : [≈]
bitops-bits-in-byte.js   24k ->   24k      
             +0.000%
  2.770s ->   2.700s                      
                 +2.527%  (+-0.909%) : [+]
bitops-bitwise-and.js   24k ->   24k      
             +0.000%
  3.820s ->   3.710s                      
                 +2.880%  (+-0.658%) : [+]
controlflow-recursive.js  192k ->  192k      
             +0.000%
  0.930s ->   0.910s                      
                 +2.151%  (+-0.000%) : [+]
crypto-aes.js  112k ->  112k      
             +0.000%
  4.723s ->   4.632s                      
                 +1.941%  (+-0.581%) : [+]
crypto-md5.js  172k ->  172k      
             +0.000%
 21.488s ->  21.583s                      
                 -0.442%  (+-0.354%) : [-]
crypto-sha1.js  124k ->  124k      
             +0.000%
  9.765s ->   9.772s                      
                 -0.068%  (+-0.586%) : [≈]
date-format-tofte.js   52k ->   52k      
             +0.000%
  2.243s ->   2.215s                      
                 +1.263%  (+-1.258%) : [+]
date-format-xparb.js   60k ->   60k      
             +0.000%
  1.095s ->   1.107s                      
                 -1.066%  (+-1.138%) : [≈]
math-cordic.js   28k ->   32k      
            -14.286%
  3.140s ->   3.060s                      
                 +2.548%  (+-0.802%) : [+]
math-partial-sums.js   24k ->   28k      
            -16.667%
  1.717s ->   1.718s                      
                 -0.097%  (+-0.632%) : [≈]
math-spectral-norm.js   32k ->   32k      
             +0.000%
  1.530s ->   1.508s                      
                 +1.416%  (+-0.439%) : [+]
string-fasta.js   40k ->   36k      
            +10.000%
  4.598s ->   4.703s                      
                 -2.283%  (+-0.613%) : [-]
Geometric mean: RSS reduction: -1.078% Speed up: 1.011% (+-0.175%) : [+]

@LaszloLango LaszloLango force-pushed the boost-magic-sting-length-calculation branch from 41267ac to 41e8151 Compare February 17, 2016 12:55
};

JERRY_ASSERT (id < LIT_MAGIC_STRING__COUNT);

Copy link
Member

Choose a reason for hiding this comment

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

The removed lit_magic_strings_init initialized the ecma_magic_string_max_length global variable (in debug build; and the var is only declared in debug builds). However, this replacement leaves that variable uninitialized. I guess that it would not be that simple to calculate the max length at compile time, but then the var should be removed and all the code that depends on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't notice that global variable. All the tests passed, so I think we should remove that variable.

Calculate magic string length sizes in compile time.

JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
@LaszloLango LaszloLango force-pushed the boost-magic-sting-length-calculation branch from 41e8151 to db26cb2 Compare February 18, 2016 07:55
@LaszloLango
Copy link
Contributor Author

@akiss77, I've updated the PR. Please check.

@zherczeg
Copy link
Member

LGTM

@akosthekiss
Copy link
Member

@LaszloLango thanks for the update. LGTM (FWIW)

@LaszloLango LaszloLango merged commit db26cb2 into jerryscript-project:master Feb 18, 2016
@LaszloLango LaszloLango deleted the boost-magic-sting-length-calculation branch February 19, 2016 15:04
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