Yea I'm not a fan of that either but well.. Last dumb question: Why is that faster than taking the prototype chain walk?
-
-
Replying to @g33konaut
Mutating the prototype takes you off the slow path as no assumptions can be made. With Symbol.species the engine nows it’s still an Array
1 reply 0 retweets 2 likes -
Replying to @DasSurma @g33konaut
I hope I got this right. cc
@_gsathya to keep me honest.2 replies 0 retweets 1 like -
or cc
@bmeurer ?? One of those two taught me that :D1 reply 0 retweets 1 like -
Mutating the Array.prototype should be mostly fine, depending on what you do exactly (of course).
1 reply 0 retweets 3 likes -
can you give an example where mutating prototype is worse than Symbol.species
2 replies 0 retweets 0 likes -
The really bad thing(TM) happens when you put elements onto the Array.prototype, i.e. Array.prototype[0] = "I'm smart";
1 reply 0 retweets 3 likes -
Ah, that’s what I meant! If you want custom methods on array and you do http://Array.prototype.zip = (a,b) => ... That’s bad, right?
1 reply 0 retweets 0 likes -
Those aren't elements, but properties (in V8 speak), see
@mathias blog post. Putting methods on the array prototype should be fine (mostly).1 reply 0 retweets 6 likes -
Replying to @bmeurer @g33konaut and
*grumble* I swear someone told me not top mutate prototype when I published underdash. Thanks for taking the time to explain :)
4 replies 0 retweets 1 like
It’s still a composability problem and thus a bad practice! Just not one that affects performance in @v8js (in most cases).
-
-
Yes and Yes
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.