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() and Object.seal() performance consideration #14789

Closed
vsemozhetbyt opened this issue Aug 12, 2017 · 4 comments
Closed

Object.freeze() and Object.seal() performance consideration #14789

vsemozhetbyt opened this issue Aug 12, 2017 · 4 comments
Labels
performance Issues and PRs related to the performance of Node.js. question Issues that look for answers. v8 engine Issues and PRs related to the V8 dependency.

Comments

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Aug 12, 2017

Recently, @bmeurer has written an article about possible performance penalty for frozen and sealed objects. We have two exposed ones: in zlib.js and in util.js. I cannot assess if there may be any penalty there or can we get away another way there, but maybe @nodejs/v8 can clarify. Sorry if I bother in vain.

@vsemozhetbyt vsemozhetbyt added performance Issues and PRs related to the performance of Node.js. question Issues that look for answers. v8 engine Issues and PRs related to the V8 dependency. labels Aug 12, 2017
@TimothyGu
Copy link
Member

FWIW neither of the frozen objects is used as a prototype. I think we are in the clear.

@addaleax
Copy link
Member

As I understand the article, the core of the issue is that freezing puts objects into dictionary mode. For the zlib one, that is okay, for the util one that does seem like a bad idea.

@silverwind
Copy link
Contributor

I added the one in util so one cannot delete properties and break inspect, but I guess we could as well drop it, as no other parts of node are really protected against delete.

@BridgeAR
Copy link
Member

When I refactored the util code I also changed the access to the object and it performs nicely now. I think I actually benchmarked a regular object against the sealed one as well and there was no difference.

I am going to close this as I do not see anything that is to do right now.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Issues and PRs related to the performance of Node.js. question Issues that look for answers. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

5 participants