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

Object.freeze #67

Open
PigBoT opened this issue Sep 10, 2015 · 2 comments
Open

Object.freeze #67

PigBoT opened this issue Sep 10, 2015 · 2 comments

Comments

@PigBoT
Copy link

PigBoT commented Sep 10, 2015

Great guide, thank you!

I was sad to see Object.freeze at the bottom, included in the 'Crazy shit' group. I've been using it in some of my projects lately, but only by using the constant naming convention, like enums. There are also some speed optimizations appearing when using Object.freeze. Any further thoughts on this? Would it make sense to take it out of the 'Crazy shit' group, when used with a naming convention?

A little more info with a small example:
http://stackoverflow.com/a/31906266/2280394

@dsernst
Copy link

dsernst commented Nov 27, 2015

What are the speed optimizations?

@PigBoT
Copy link
Author

PigBoT commented Nov 27, 2015

Here's a jsperf with some tests. Seems to fluctuate. I wouldn't necessarily recommend object.freeze based on speed alone. Thoughts?

http://jsperf.com/freeze-vs-seal-vs-normal/21

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

No branches or pull requests

2 participants