1000x FASTER JavaScript?

preview_player
Показать описание
Recorded live on twitch, GET IN

MY MAIN YT CHANNEL: Has well edited engineering videos

Discord
Рекомендации по теме
Комментарии
Автор

imagine saying that you are limited by the 4GHz processor making webapp to the computer scientist from the past that works with punch cards and 5Hz light bulb computer

capsey_
Автор

It is so incredible how Prime can absorb and explain code instantly, how good he is at recognising and understanding the nuance of what's going on.
And right on the next line stumbles on the simplest english sentence

thesilph
Автор

This video has taught me so much and forever changed the way I look at the spread operator. Your commentary with your expertise also adds a lot of things I wouldn’t catch if I had read the article myself. Thanks a bunch

seanki
Автор

This is just one of those things if you work with JavaScript you are so far detached from everything it can be easy to go for the flashy modern syntax instead of thinking about the actual memory allocations happening. I don't do anything as low level as C but in Golang I know that preallocating a fixed array will always be quicker and if I do need to create a dynamic array then I also know that everytime an append operation is called then the memory is doubled to prevent multiple re-allocations

dandogamer
Автор

Very helpful breakdown! I find most of Prime's videos quality entertainment but the ones where he explains technical things are my favorite. I don't do as much Javascript but I feel like the same memory concepts would transfer to python and data heavy pandas operations. It's easy to get tempted to use some snazzy one liner without realizing you're going to enter into a world of hurt later on haha. And love the advice at the end, just need to endeavour to learn one level deeper about what you're doing, so helpful. Thanks Prime!

akaTelo
Автор

If you want to write functional code, use a functional language that was designed for it. Immutable JavaScript is an anchor and the language wasn't designed for it.

Despite lists being immutable In a language like Elixir or Clojure, it won't copy the whole list every time you add something to it - because the language was built around immutability the libraries can take advantage of structural sharing. When you add an element to a list 50k long, it doesn't construct a whole new list with 50, 001 elements, it re-uses the 50k list and adds a new node. Other variables referencing the 50k list will still only see the 50k elements.

This is safe in these languages because no other code can change that 50k list out from under you.

bobbycrosby
Автор

This is what happens when you're detached from whats going on under the hood.
He didn't push because the syntax sugar looked cooler/cleaner to him, guaranteed.

zeez
Автор

It's incredible how much one learns from primagen screaming

joaomendoncayt
Автор

This is awesome to be talked through, more optimisation content is extremely welcome

licriss
Автор

The problem is that people want functional features in JS. The JS compiler doesn't have the optimizations (or the required information to perform those optimizations) to avoid allocating.

jonasync
Автор

learned something new thank you moustache man

furkandemirbilek
Автор

I started a library of functions intended to be "Pure", but eventually this library just turned into a bunch of handy functions that "might" be immutable. For any heavily used function it is always far too expensive to shun mutation.

Also, the most challenging function I added was a mergeObjects, but the cool thing is it is also a cloneObject since you are just merging an existing object onto a new empty object.

JoshuaHeagleDev
Автор

In functional languages immutable patterns can be faster. Since the runtime knows that nothing else can change the list it will can share common data between different "versions" of the list

fishfpv
Автор

Lesson: don't trust JavaScript's sugarcoated syntax

indrajitsarkar
Автор

I love this channel. Very humbling. Every time I tell myself "I'm a good dev" I watch an episode to realize I don't know anything.

InspiredArc
Автор

"You don't have to go all in, just a little deeper" - that's what she said.

TechdubberStudios
Автор

14:55 is always me whenever i code review

flamendless
Автор

This video was super informational, please do more like these on Javascript / React! Thank you!

zameschua
Автор

24:51 "pushing into it over and over again". That's exactly what amortized means

Turalcar
Автор

one more: learning a programming language that doesn't uses GC really helps a lot as well. Nice video!

hirisraharjo