How $compileProvider.debugInfoEnabled set to false improve performance in angularjs 1.3?
Asked Answered
R

1

8

I read the the documentation from angular website about debugInfoEnabled. Still doesn't clear with concept, how $compileProvider.debugInfoEnabled(false) inside angular config can improve the performance of application by removing the element level class (angular-directives) binding such as ng-scope and ng-isolated-scope.

Does anyone know, how performance boost can happen by setting up debugInfoEnabled to false in $compileProvider? Can anyone help me to clear out my concept about angular $compileProvider.debugInfoEnabled feature of angular 1.3?

Any Help would appreciated, Thanks in advance:)

Reveal answered 17/1, 2015 at 17:21 Comment(0)
D
13

These classes that are added to your DOM elements are directives (directive can be elements, attributes, classes, or comments).

When angular is compiling the DOM and hits a directive it then runs through that directives logic to change, manipulate, update, or do whatever task it is that the directive is asking angular to do.

For example it will take your ng-repeat directives and build out multiple DOM elements accordingly.

By removing these directives (classes like ng-scope & ng-isolated-scope) angular will not stop at these locations and execute logic. Because of this the performance increase is achieved.

Deductive answered 17/1, 2015 at 18:48 Comment(7)
No problemo, my pleasureDeductive
That means angular $compileProvider.debugInfoEnabled(false) only don't bind ng-scope & ng-isolated-scope. That's all?Reveal
From Angular website: > Where the compiler has created a new scope, the scope and either ng-scope or ng-isolated-scope CSS class are attached to the corresponding elementDeductive
I read from angular documentation, and i mentioned the same in my question.I asked you, this is the only thing $compileProvider.debugInfoEnabled(false) does?Reveal
To my knowledge yes, considering your entire Angular application contains many many different scopes, this is actually quite a bit that it is doing. You can see just how many levels of sibling and nested scopes exist in your application by using the chrome extension BatarangDeductive
Thanks Jacob for your valuable timeReveal
Perhaps worth mentioning this excerpt from the docs : Tools like Protractor and Batarang need this information to run ..Kauslick

© 2022 - 2024 — McMap. All rights reserved.