3 ms·
I'm curious about the speed hit of these parsed expressions. Do you know if they are pre-compiled into anonymous functions, or if they are parsed on the fly?
by lukifer 14y ago
I'm curious about the speed hit of these parsed expressions. Do you know if they are pre-compiled into anonymous functions, or if they are parsed on the fly?
- aswanson 14y agoWas thinking the same thing. My guess is on-the-fly parsing.
- snprbob86 14y agoSee: https://github.com/angular/angular.js/blob/9480136d9f062ec4b8df0a35914b48c0d61e0002/src/ng/parse.js#L797-L846 https://github.com/angular/angular.js/blob/9480136d9f062ec4b... Looks like they are never interpreted, but there are (at least) two different compilation strategies: 1) Anonymous function with a loop 2) Fully compiled Function constructed via JavaScript source with the loop unrolled In general, this bit of code seems to be optimized to a crazy degree. It's also worth noting that the "filters" part of the expression is maintained as a pipeline in an array, since filters may inform bidiectional binding behavior.