Message from JavaScript discussions

October 2018



Also, ive read some Papa Crockford article, where he says that you may not even use new keyword, but.. the v8 articles about monomorphic vs polymorphic object say you must use new to reach super-speed. that video, ive dropped, says that JS code may run only 17% slower than C/C++ code if it's monomorphic

— Going to test it and compare the result vs. greensock-js, will see

— The speed is from object structure cache

— V8 tries to cache that information, and if it changes (such as while you add props in a factory) there is additional overhead needed for a lookup as cache misses occur

Message permanent page

— It gets worse if you change the structure of the hot prototype

— __proto__ I mean

— But for regular objects it is not noticeable really

— Let me know when you post results!

— There is no reason you can not access this in an arrow function, but it does behave differently... not respecting bind/call is one difference, and the other is that the call does not look left. In a method call that is how this is set, by quite literally looking to the left of the dot in the memberExpression

Message permanent page

— So, this will be whatever it was set to in the parent scope

— It can sometimes be useful to not allow this to change in your functions when you are setting up nested callbacks

Message permanent page