Due to its dynamic nature, formly necessarily adds a lot of watchers. By my count, there's about 5 watchers added whenever a <formly-form> is used and anywhere from 9 to ~25 watchers added for each <formly-field>. 9 would be for just a field like { template: '<hr/>' } and I've seen around 25 for a typical formlyBootstrap field (and maybe some ng-messages stuff added in).
While number of watchers isn't the only performance metric to look at, I think it's fairly directly related in this case. And while there should definitely be a tradeoff assumed when using something dynamic like formly, I wonder if we could get that number down at all by leveraging one-time binding. Though I have to imagine there probably wouldn't be that many things that we could globally one-time bind since there's so many different options and use cases and some need some parts "live" while others need other parts "live."
I wonder if we could at least provide a master one-time-binding opt-in setting for folks who don't need very dynamic forms (maybe just leave ng-model-type stuff two-way bound and one-time-bind everything else?). Or perhaps let users configure which parts of the <formly-form> and <formly-field> they want one-time bound?
I really don't even know what this would look like and I understand this might not be possible for people using formly with Angular 1.2, but perhaps others could give thoughts or feedback on whether and/or how this might work.
Due to its dynamic nature, formly necessarily adds a lot of watchers. By my count, there's about 5 watchers added whenever a
<formly-form>
is used and anywhere from 9 to ~25 watchers added for each<formly-field>
. 9 would be for just a field like{ template: '<hr/>' }
and I've seen around 25 for a typical formlyBootstrap field (and maybe some ng-messages stuff added in).While number of watchers isn't the only performance metric to look at, I think it's fairly directly related in this case. And while there should definitely be a tradeoff assumed when using something dynamic like formly, I wonder if we could get that number down at all by leveraging one-time binding. Though I have to imagine there probably wouldn't be that many things that we could globally one-time bind since there's so many different options and use cases and some need some parts "live" while others need other parts "live."
I wonder if we could at least provide a master one-time-binding opt-in setting for folks who don't need very dynamic forms (maybe just leave
ng-model
-type stuff two-way bound and one-time-bind everything else?). Or perhaps let users configure which parts of the<formly-form>
and<formly-field>
they want one-time bound?I really don't even know what this would look like and I understand this might not be possible for people using formly with Angular 1.2, but perhaps others could give thoughts or feedback on whether and/or how this might work.