diff options
| author | jankuca | 2013-08-20 17:19:49 -0700 |
|---|---|---|
| committer | Igor Minar | 2013-10-04 14:15:56 -0700 |
| commit | 49e06eace58d871972f0cf3ec92aa28e19c4b02b (patch) | |
| tree | e32ab386133b57cbe5e4f99c40eaaf398e65a504 /test/ng | |
| parent | 948e8ca3250f2e806e6c822fbaee64f8e54c2a53 (diff) | |
| download | angular.js-49e06eace58d871972f0cf3ec92aa28e19c4b02b.tar.bz2 | |
chore($parse): convert parser() and lex() to prototype-based code
This reduces memory consumption of parsed angular expressions and
speeds up parsing.
This JSPerf case demonstrates the performance boost:
http://jsperf.com/closure-vs-prototype-ngparser
Chrome: 1.5–2x boost
FF: slightly slower (I would love to know why)
IE: 4x boost
To be clear, this doesn't have any impact on runtime performance
of expressions as demostrated in this JSPerf:
http://jsperf.com/angular-parser-changes
Closes #3681
Diffstat (limited to 'test/ng')
| -rw-r--r-- | test/ng/parseSpec.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js index 44b648c5..87cc79af 100644 --- a/test/ng/parseSpec.js +++ b/test/ng/parseSpec.js @@ -2,6 +2,15 @@ describe('parser', function() { describe('lexer', function() { + var lex; + + beforeEach(function () { + lex = function () { + var lexer = new Lexer(); + return lexer.lex.apply(lexer, arguments); + }; + }); + it('should tokenize a string', function() { var tokens = lex("a.bc[22]+1.3|f:'a\\\'c':\"d\\\"e\""); var i = 0; |
