Skip to content
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

Added reserved word conflict prevention in Google's Closure Compiler #668

Merged
merged 2 commits into from
Jun 7, 2012
Merged

Added reserved word conflict prevention in Google's Closure Compiler #668

merged 2 commits into from
Jun 7, 2012

Conversation

caseywebdev
Copy link
Contributor

(and possibly other parsers too)

Go to http://closure-compiler.appspot.com/home and enter var ac = a.class; to see what I mean.

…(and possibly other parsers too)


Go to http://closure-compiler.appspot.com/home and enter `var ac = a.class;` to see what I mean.
@tj
Copy link
Contributor

tj commented Jun 7, 2012

why not just use the string in each spot? a['class'] etc is a bit nicer than using the var IMO, after that I'll merge

@caseywebdev
Copy link
Contributor Author

I assumed Google Closure (Uglify does this) would convert klass = 'class' to a = 'class' and then save bytes by replacing all of the b[klass] with b[a], but it looks like GC substitutes the string where the variable was. I wonder if initializing strings is faster than variable lookups?

@tj
Copy link
Contributor

tj commented Jun 7, 2012

faster here is really irrelevant, for several reasons but even without a JIT it's a tiny tiny tiny tiny micro-optimization

tj added a commit that referenced this pull request Jun 7, 2012
Added reserved word conflict prevention in Google's Closure Compiler
@tj tj merged commit 56ca564 into pugjs:master Jun 7, 2012
@caseywebdev
Copy link
Contributor Author

So how small is the optimization? =p

Thanks for the quick merge!

@tj
Copy link
Contributor

tj commented Jun 7, 2012

way too small to care about at all ever :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants