Skip to content

Make options object prototype-inherited#2300

Merged
mourner merged 3 commits intomasterfrom
prototypal-options
Dec 16, 2013
Merged

Make options object prototype-inherited#2300
mourner merged 3 commits intomasterfrom
prototypal-options

Conversation

@jfirebaugh
Copy link
Copy Markdown
Member

Fixes #2294

Comment thread src/core/Class.js
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also reuse L.Util.create above for proto creation, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, f2b34cd

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful.

@mourner
Copy link
Copy Markdown
Member

mourner commented Dec 15, 2013

This is awesome, thanks a lot for taking on this!

@mourner
Copy link
Copy Markdown
Member

mourner commented Dec 15, 2013

BTW, did you look how it affects performance? Like, measure instantiating 100000 markers with some options?

@mourner
Copy link
Copy Markdown
Member

mourner commented Dec 15, 2013

Also, I guess accessing properties that got inherited will become a bit slower because of prototype chain lookup, but it would be insignificant in theory.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a real use case for this? Not doing the hasOwnProperty check makes it a little faster.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that if L.Util.setOptions was called multiple times on the same object you wouldn't want it to add another link in the prototype chain each time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah that makes sense! So all the setStyle stuff would be affected, etc.

@jfirebaugh
Copy link
Copy Markdown
Member Author

No, I didn't do any performance testing.

mourner added a commit that referenced this pull request Dec 16, 2013
Make options object prototype-inherited
@mourner mourner merged commit a78dc74 into master Dec 16, 2013
@mourner mourner deleted the prototypal-options branch December 16, 2013 23:37
@patrickarlt patrickarlt mentioned this pull request Dec 21, 2014
60 tasks
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.

Make options object prototype-inherited

3 participants