▲ | hajile 7 days ago | |||||||||||||
Closures won over OOP in Javascript a long time ago (eg, React switching from classes to functions + closures), but they still keep trying to force garbage like private variables on the community. Loads of features have been added to JS that have worse performance or theoretically enable worse performance, but that never stopped them before. Some concrete (not-exhaustive) examples: * Private variables are generally 30-50% slower than non-private variables (and also break proxies). * let/const are a few percent slower than var. * Generators are slower than loops. * Iterators are often slower due to generating garbage for return values. * Rest/spread operators hide that you're allocating new arrays and objects. * Proxies cause insane slowdowns of your code. * Allowing sub-classing of builtins makes everything slow. * BigInt as designs is almost always slower than the engine's inferred 31-bit integers. Meanwhile, Google and Mozilla refuse to implement proper tail calls even though they would INCREASE performance for a lot of code. They killed their SIMD projects (despite having them already implemented) which also reduced performance for the most performance-sensitive applications. It seems obvious that performance is a non-issue when it's something they want to add and an easy excuse when it's something they don't want to add. | ||||||||||||||
▲ | tracker1 7 days ago | parent | next [-] | |||||||||||||
I wish I could upvote this more than once. I really liked the F# inspired pipe operator proposal and even used it a bit when I used to lean on 6to4/babel more, but it just sat and languished forever it seems. I can't really think of any other language feature I've seen since that I would have wanted more. The new Temporal being one exception. | ||||||||||||||
| ||||||||||||||
▲ | int_19h 7 days ago | parent | prev [-] | |||||||||||||
> * Rest/spread operators hide that you're allocating new arrays and objects. Only in function calls, surely? If you're using spread inside [] or {} then you already know that it allocates. | ||||||||||||||
|