feat(dart/transform): Use the best available Change Detectors
Enable pregenerated (for Dart) and JIT (for Js) change detectors when possible. Previously we would always use `DynamicChangeDetector`s, but these cause megamorphic calls and are therefore much slower. Closes #502
This commit is contained in:
@@ -20,7 +20,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it("should return a proto change detector when one is available", () => {
|
||||
var map = {'id': (registry) => proto};
|
||||
var map = {'id': (registry, def) => proto};
|
||||
var cd = new PreGeneratedChangeDetection(null, map);
|
||||
|
||||
expect(cd.createProtoChangeDetector(def)).toBe(proto)
|
||||
|
||||
@@ -37,7 +37,6 @@ import {
|
||||
ON_PUSH,
|
||||
DEFAULT,
|
||||
WrappedValue,
|
||||
JitProtoChangeDetector,
|
||||
DynamicProtoChangeDetector,
|
||||
ChangeDetectorDefinition,
|
||||
Lexer,
|
||||
@@ -45,6 +44,7 @@ import {
|
||||
Locals,
|
||||
ProtoChangeDetector
|
||||
} from 'angular2/change_detection';
|
||||
import {JitProtoChangeDetector} from 'angular2/src/change_detection/jit_proto_change_detector';
|
||||
|
||||
import {getDefinition} from './change_detector_config';
|
||||
import {getFactoryById} from './generated/change_detector_classes';
|
||||
|
||||
+1
-3
@@ -22,8 +22,6 @@ void initReflector(reflector) {
|
||||
..registerType(HelloCmp, {
|
||||
'factory': () => new HelloCmp(),
|
||||
'parameters': const [const []],
|
||||
'annotations': const [
|
||||
const Component(changeDetection: 'CHECK_ONCE')
|
||||
]
|
||||
'annotations': const [const Component(changeDetection: 'CHECK_ONCE')]
|
||||
});
|
||||
}
|
||||
|
||||
+1
-3
@@ -22,8 +22,6 @@ void initReflector(reflector) {
|
||||
..registerType(HelloCmp, {
|
||||
'factory': () => new HelloCmp(),
|
||||
'parameters': const [const []],
|
||||
'annotations': const [
|
||||
const Component(events: ['onFoo', 'onBar'])
|
||||
]
|
||||
'annotations': const [const Component(events: ['onFoo', 'onBar'])]
|
||||
});
|
||||
}
|
||||
|
||||
+2
@@ -20,6 +20,8 @@ void initReflector(reflector) {
|
||||
const View(template: 'Salad')
|
||||
]
|
||||
});
|
||||
_gen.preGeneratedProtoDetectors['MyComponent_comp_0'] =
|
||||
_MyComponent_ChangeDetector0.newProtoChangeDetector;
|
||||
}
|
||||
class _MyComponent_ChangeDetector0 extends _gen.AbstractChangeDetector {
|
||||
final dynamic _dispatcher;
|
||||
|
||||
Reference in New Issue
Block a user