You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there some special reason why you use bracket notation this["re"] instead of dot notationthis.re to access properties? I find the latter easier to read.
Yep, I like the latter also better, but I set these on all the attributes I want to keep as they are, when they run through closure compiler in advanced mode. I started to use the advanced mode for all my projects and so I rename the attributes after finishing a project to the bracket version. This is only a little tradeoff compared to the things closure compiler brings in advanced mode, like function inlining, and code rewriting in a more optical way.
Yep, closure compiler tries to minimize them (1-2 chars) if they are not getting exported. By using this explicit syntax, you can mark them as an api. It also tries to remove objects at all. For example the P object, you don't like - if the compiler sees this object has constantly 2 attributes, it will make two variables of it (I'm not sure if in the case of P this really happens, but it tries to flatten internal objects)
I think not performance, as the lookup mechanism of v8 is quite advanced with it's hidden classes. Closure compiler tries to optimize for gzip, meaning building a lot of similar chunks of code, which at the end benefits performance as performance in the web means loading time.
And for debugging: You shouldn't debug your minimized code in the best case ;P
Activity
infusion commentedon Feb 4, 2016
Yep, I like the latter also better, but I set these on all the attributes I want to keep as they are, when they run through closure compiler in advanced mode. I started to use the advanced mode for all my projects and so I rename the attributes after finishing a project to the bracket version. This is only a little tradeoff compared to the things closure compiler brings in advanced mode, like function inlining, and code rewriting in a more optical way.
josdejong commentedon Feb 4, 2016
Ah, does closure compiler mangle the property names too?! hm, that's not nice. I didn't know that
infusion commentedon Feb 4, 2016
Yep, closure compiler tries to minimize them (1-2 chars) if they are not getting exported. By using this explicit syntax, you can mark them as an api. It also tries to remove objects at all. For example the P object, you don't like - if the compiler sees this object has constantly 2 attributes, it will make two variables of it (I'm not sure if in the case of P this really happens, but it tries to flatten internal objects)
josdejong commentedon Feb 4, 2016
Well, it makes sense of course - mangling internal variable names. But it's not handy debuging in this case, you want to see
reandim.As for
Pbeing replaced by two variables - that actually sounds like a good idea - it's just internals and will probably improve performance :Dinfusion commentedon Feb 4, 2016
I think not performance, as the lookup mechanism of v8 is quite advanced with it's hidden classes. Closure compiler tries to optimize for gzip, meaning building a lot of similar chunks of code, which at the end benefits performance as performance in the web means loading time.
And for debugging: You shouldn't debug your minimized code in the best case ;P