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
General code generation cleanups #3248
Comments
fyi, per our discussion i'm currently working on |
Step 1: Determine if "Normalize string / No interpolation" provides any benefit |
Create `NameRegistry`, responsible for understanding how names are generated for change detector fields and variables. Use `NameRegistry` for both JS Jit & Dart pre-generated detectors. Making progress on angular#3248
Create `NameRegistry`, responsible for understanding how names are generated for change detector fields and variables. Use `NameRegistry` for both JS Jit & Dart pre-generated detectors. Making progress on #3248
Previously, `uninitialized()` was a method, requiring a call as well as two extra characters everywhere it was used. Make this value a variable, saving the characters and avoiding the method call to get its value. This change also removes the export of `uninitialized` from change_detect.ts, which is technically a breaking change, however `uninitialized` is an implementation detail and nobody should be using it in app logic. By convention, apps should not be importing from files under `src/`. Update to angular#3248.
Previously, `uninitialized()` was a method, requiring a call as well as two extra characters everywhere it was used. Make this value a variable, saving the characters and avoiding the method call to get its value. This change also removes the export of `uninitialized` from change_detect.ts, which is technically a breaking change, however `uninitialized` is an implementation detail and nobody should be using it in app logic. By convention, apps should not be importing from files under `src/`. Update to angular#3248.
Create `looseNotIdentical => !looseIdentical`, which will save a lot of unnecessary '!' characters in generated change detectors. Update to angular#3248
Add additional details here! Update to angular#3248
Add additional details here! Update to angular#3248
Call new `(de)hydrateDirectives` methods from `(de)hydrate`. Add a null implementation in `AbstractChangeDetector` and only override if necessary for the specific change detector. Update to angular#3248
Create `looseNotIdentical => !looseIdentical`, which will save a lot of unnecessary '!' characters in generated change detectors. Update to angular#3248
This issue proposes to optimize the size of code that we should not be generating at all. Therefore, fixing any of these will have 0 net effect on code size once we stop generating it. I'd rather we spent our time on the ultimate solution. The ultimate solution is to move all value fields, and comparison and notification logic into common classes. Generated code should only be responsible for evaluating expressions in a typed and monomorphic manner. Here are two ways (which we can combine) for how we can do this: https://docs.google.com/document/d/1x8MmbK3bKJb5JFrz3SmLfUsWYURZhYqPux12zKm1i8k/edit# |
@yjbanov , I commented on that doc but in summary I'm not confident we'll be able to implement that scheme without performance impact. Most of the In the mean time, this process is cutting down on code duplication, which should make any ultimate solution easier to implement. |
Call new `(de)hydrateDirectives` methods from `(de)hydrate`. Add a null implementation in `AbstractChangeDetector` and only override if necessary for the specific change detector. Update to angular#3248
Move fields common to Dynamic, Jit, and Pregen change detectors into the `AbstractChangeDetector` superclass to save on codegen size and reduce code duplication. Update to angular#3248
Move fields common to Dynamic, Jit, and Pregen change detectors into the `AbstractChangeDetector` superclass to save on codegen size and reduce code duplication. Update to angular#3248, closes angular#3243
Move fields common to Dynamic, Jit, and Pregen change detectors into the `AbstractChangeDetector` superclass to save on codegen size and reduce code duplication. Update to angular#3248, closes angular#3243
Move fields common to Dynamic, Jit, and Pregen change detectors into the `AbstractChangeDetector` superclass to save on codegen size and reduce code duplication. Update to angular#3248, closes angular#3243
I won't be finishing either this milestone as I'm out the next couple of days. |
The remaining points here are not as urgent as supporting |
Change detectors & code generation in general have changed a lot - this is now obsolete. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Normalize string / No interpolation
interpolate1 = "" "${componentName0 == null ? "" : componentName0}" ""
withinterpolate1 = " " + stringify(componentName0) + " ";
NOTE: will require import ofstringify
method. I think${}
creates extra unneeded checks, so simple string concat+
should be better in this case.Inline assignments
``` Dart``
_componentName0 = _gen.ChangeDetectionUtil.uninitialized();
_interpolate1 = _gen.ChangeDetectionUtil.uninitialized();
_directive_1_0 = _gen.ChangeDetectionUtil.uninitialized();
_directive_2_0 = _gen.ChangeDetectionUtil.uninitialized();
dehydrateDirectives()
from constructor so that we don't have to duplicate the code in the constructor.Inline assignments and usages
becomes
have
notifyOnBinding
helperviewSet
in super. Notice that_dispatcher
is always a View. This code is no longer abstract so we should use concrete names.becomes
which requires this method on superclass
looseNotIdentical
loseNotIdentical
which will allow us to changeif (!_gen.looseIdentical(...))
toif (_gen.looseNotIdentical(...))
. (its only one char, but it is everywhere)inline context assignment
should be
Unused
change_context
but is never read.
change
uninitialized()
method call touninitialized
static fieldThe text was updated successfully, but these errors were encountered: