mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
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
This commit is contained in:
parent
948e8ca325
commit
49e06eace5
2 changed files with 500 additions and 429 deletions
920
src/ng/parse.js
920
src/ng/parse.js
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue