Go 1.20 Memory Arenas Are AMAZING | Prime Reacts

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ค. 2023
  • Recorded live on twitch, GET IN
    / theprimeagen
    Article: pyroscope.io/blog/go-1-20-mem...
    Author: Dmitry Filimonov | github.com/petethepig
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
    Have something for me to read or react to?: / theprimeagenreact
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 197

  • @colbyberger1881
    @colbyberger1881 11 หลายเดือนก่อน +285

    Learning golang and building efficient backend systems has been a lot of fun for me. Great language!

    • @Dev-Siri
      @Dev-Siri 11 หลายเดือนก่อน +1

      same

    • @Mathes881
      @Mathes881 11 หลายเดือนก่อน +1

      What specific backend systems have you built with golang?

    • @FernandoBaldrich
      @FernandoBaldrich 11 หลายเดือนก่อน

      what libraries do you use for backend? im in the process of learning it!

    • @elisiosa3111
      @elisiosa3111 11 หลายเดือนก่อน +2

      @colbyberger1881 what is more used in the industry to build backend services in go, standard net/htttp package or frameworks like Gin or fibre?

    • @KMoscRD
      @KMoscRD 11 หลายเดือนก่อน +4

      I'm learning go now, fucking insane experience. I love it

  • @therealestsnake
    @therealestsnake 11 หลายเดือนก่อน +87

    can't wait to see go 1.21 that introduces memory battle royales!

  • @GingerGames
    @GingerGames 11 หลายเดือนก่อน +160

    I love how people are rediscovering Arenas again! They are pretty much all I use for all my allocation needs because an arena equates to a lifetime group for allocations. And using arenas (like in Odin), you can just free all of the things at once rather than individually (e.g. paired malloc/free in C), which means in practice, you rarely need to free anything manually and just allocate when needed. And because arenas are really simple allocators, they are as fast as they can possibly get compared to any other memory allocation strategy.

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  11 หลายเดือนก่อน +72

      yeah, this is really beautiful way of doing things. for me, this makes go significantly more attractive as a language.

    • @Caboose2563
      @Caboose2563 11 หลายเดือนก่อน +22

      I was surprised to see Odin mentioned, then I saw who posted it lol.
      Love Odin, don't use it for anything serious, but it's a pleasant experience.

    • @ScibbieGames
      @ScibbieGames 11 หลายเดือนก่อน +5

      ​@@ThePrimeTimeagen
      I think this makes Go a more attractive alternative to Zig in some cases.
      It's performant, easy to use, and now has performance as an option? That's great!

    • @CamaradaArdi
      @CamaradaArdi 11 หลายเดือนก่อน +1

      Are arenas built in odin?
      Also, noob question, why would you use an arena over a bump allocator?

    • @jacksonlevine9236
      @jacksonlevine9236 11 หลายเดือนก่อน +1

      ​@@Caboose2563Why would you not use it for anything serious?

  • @FabulousFadz
    @FabulousFadz 11 หลายเดือนก่อน +30

    6:05 regarding Go's GC. This is a very simplified overview because I can't detail it all in the comments, but the GC in go is mostly concurrent. It's a mark and sweep GC and when it kicks in, it takes 25% of the cores to identify what needs to be cleaned and what can live on. It does stop the world for a little bit for the cleanup but in general allocations can still happen when the GC is working since 75% of the go routines running are doing your work as opposed to 25% for the GC.
    I love Arenas btw.

  • @captainfordo1
    @captainfordo1 11 หลายเดือนก่อน +31

    Arenas make memory management in C almost trivial, so I'm very excited that Go is getting them too. It seems like Go is going in the right direction as opposed to other modern languages in my opinion.

  • @not6793
    @not6793 11 หลายเดือนก่อน +59

    I use memory arenas for some years now in C, it does not only improve performance over malloc everything, it also simplifies memory managment. You think more about lifetimes of groups then lifetimes of individual allocated objects (and free everything at ones instead of one by one.

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  11 หลายเดือนก่อน +11

      seems better

    • @TheSulross
      @TheSulross 9 หลายเดือนก่อน +1

      C programmers been doing arena mem mgt for decades - for long running programs (as in 24/7) it can also aide in reducing memory fragmentation. This latter is a concern for Go programs as its GC doesn't do heap compaction (like, say, the Java GC implementations do).

  • @JonathanDunlap
    @JonathanDunlap 11 หลายเดือนก่อน +2

    Love your energy and passion doing these update videos, while also digging into the details. Keep it up friend!

  • @genemys
    @genemys 11 หลายเดือนก่อน +10

    I can see prime is starting his go arc

  • @mattbutler2344
    @mattbutler2344 11 หลายเดือนก่อน +2

    This was your best content in a while. Straightforward and informative, gg

  • @user-zm3ys9ym3q
    @user-zm3ys9ym3q 11 หลายเดือนก่อน +19

    Unfortunately, as the article notes, this memarena proposal is currently on hold and, as Ian says, "No decision has been made and likely won't be made anytime soon."
    So yeah, I was really excited about this feature as well, but now a bit conflicted feelings about it

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  11 หลายเดือนก่อน +12

      i am super pumped, and i really hope this goes somewhere

  • @daltonyon
    @daltonyon 11 หลายเดือนก่อน +2

    One of the best articles, piqued my curiosity to know more about go GC!

  • @grantwilliams630
    @grantwilliams630 11 หลายเดือนก่อน +13

    Arenas + deferred is my favorite part of zig. Super curious to see how golang does with arenas

  • @michaelhart8928
    @michaelhart8928 11 หลายเดือนก่อน +1

    I think in the javascript vs go example, Go would probably have to track pointers to other things and track that separately. However, if you are using a value, it would be just like part of the struct as in C (the same block of memory).
    I think a good example of this is slices where the slice header has a pointer to an array under the hood, similar to a standard array list. Copying a slice header would copy the pointer to the array, but not the array. If you do stuff to that slice while the original is unchanged, I think the copied one will eventually create a new array. Run the below test for example. You should see the capacity changing and the appends I think will cause a copy to new arrays in both. But in this case they'd be different arrays now under the hood.
    func TestSlice(t *testing.T) {
    s1 := []int{1, 2, 3}
    s2 := s1[1:]
    t.Logf("s1: %v, s2: %v", s1, s2)
    t.Logf("s1 len: %v, cap: %v", len(s1), cap(s1))
    t.Logf("s2 len: %v, cap: %v", len(s2), cap(s2))
    s2 = s2[1:]
    t.Logf("s1: %v, s2: %v", s1, s2)
    t.Logf("s1 len: %v, cap: %v", len(s1), cap(s1))
    t.Logf("s2 len: %v, cap: %v", len(s2), cap(s2))
    s2 = s2[1:]
    t.Logf("s1: %v, s2: %v", s1, s2)
    t.Logf("s1 len: %v, cap: %v", len(s1), cap(s1))
    t.Logf("s2 len: %v, cap: %v", len(s2), cap(s2))
    s2 = append(s2, 4)
    t.Logf("s1: %v, s2: %v", s1, s2)
    t.Logf("s1 len: %v, cap: %v", len(s1), cap(s1))
    t.Logf("s2 len: %v, cap: %v", len(s2), cap(s2))
    s1 = append(s1, 5)
    t.Logf("s1: %v, s2: %v", s1, s2)
    t.Logf("s1 len: %v, cap: %v", len(s1), cap(s1))
    t.Logf("s2 len: %v, cap: %v", len(s2), cap(s2))
    }

  • @smarimc
    @smarimc 11 หลายเดือนก่อน +11

    Yay arena allocators! About time Go caught up with... C. 😂
    But really though, one of the things proper modern languages should have is easy, pluggable, context-based memory allocator management.

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  11 หลายเดือนก่อน +7

      agreed, its super important

    • @smarimc
      @smarimc 11 หลายเดือนก่อน +4

      Only language I've seen with this done correctly is Jai.

  • @coffeeintocode
    @coffeeintocode 11 หลายเดือนก่อน +8

    Love this addition to Go. Slowly experimenting with pushing the language forwards

  • @tashima42
    @tashima42 11 หลายเดือนก่อน +3

    This is the first time I’ve learned about arenas, this looks amazing

  • @altstate
    @altstate 11 หลายเดือนก่อน +1

    Whoever wrote this blog post is a genius! Instant sub for sure!

  • @AlessandroStamatto
    @AlessandroStamatto 11 หลายเดือนก่อน +41

    Golang is awesome!
    It was _really_ annoying when it did not have Generics. But now that it fixed this major problem, its incredible!

    • @banatibor83
      @banatibor83 11 หลายเดือนก่อน +5

      They only have to fix the terrible error handling.

    • @chris0714ful
      @chris0714ful 11 หลายเดือนก่อน +25

      @@banatibor83eh, I wouldn’t call it terrible. Verbose, sure. Terrible would be exceptions.

    • @llothar68
      @llothar68 11 หลายเดือนก่อน

      If they would only have the garbage collector optional

    • @browut6666
      @browut6666 11 หลายเดือนก่อน +3

      @@llothar68it already is

    • @FabulousFadz
      @FabulousFadz 11 หลายเดือนก่อน +3

      @@banatibor83 I wouldn't say it's terrible. It can be verbose if all you do is just *if err != nil* it but I would take Go's error handling over exceptions any day.

  • @gravisan
    @gravisan 10 หลายเดือนก่อน

    This is effectively like a stack memory that is unwound and returned once you are done with whatever you wanted to do. Ofcourse it's a lot more flexible and I can imagine you can implement this directly on top of an OS call to fetch / return memory pages. So you use a whole page at once and return it once you are done.

  • @k98killer
    @k98killer 11 หลายเดือนก่อน

    Maybe it has changed in recent versions, but the Go GC used to work by stopping the world long enough for the GC thread to scan memory, then it would release the global lock and deallocate unused objects in the background. Of course, this applies only to memory on the heap; if you can avoid the heap altogether, then you can avoid spending time in the GC stop-the-world (easier said than done, especially if you have data that needs to be accessed concurrently via Mutex/RWMutex).

    • @k98killer
      @k98killer 11 หลายเดือนก่อน

      @@nosferratu shouldn't it be able to free memory concurrently? Idk, this topic is new to me -- I never thought much about it in the past.

  • @programaths
    @programaths 11 หลายเดือนก่อน +3

    6:02 Yes, it is. In one application I made for Domotic, the program creates an array of about 2GB so that GC is only called when a lot of memory is used. There is probably a better way to do it, but that worked at the time and was never changed.

    • @FabulousFadz
      @FabulousFadz 11 หลายเดือนก่อน +1

      Avoiding garbage collections can kind of be achieved by setting GOGC and specifying a soft memory limit. GOGC by default is 100. This number is a percentage meaning (over simplified here) that if your app is using 20MiBs of memory between the live heap, go routines, and other global pointers the GC will try to complete a cycle before the next 20MiB is allocated. If you set GOGC=200 that means in this case you can allocate an additional 40MiB before the GC kicks in.
      You can set this in combination with a memory limit which is a limit for all memory (heap, go routines, globals, stack). Regardless of the GOGC setting, the limit will be honored by the garbage collector (soft limit so this is a ballpark figure). Doubling the GOGC value will double the heap size and halve the GC CPU cost. Lastly, setting GOGC=off and a high GOMEMLIMIT, say around the 2GiB mark you mentioned, will allow your program to keep allocating until it is approaching that memory limit at which point the GC will kick in to get rid of dead objects.

    • @programaths
      @programaths 11 หลายเดือนก่อน

      @@FabulousFadz So, that would achieve the same thing.
      As the solution is working sufficiently well, I'll not change. That would be to much "customer handling" work ^^

    • @FabulousFadz
      @FabulousFadz 11 หลายเดือนก่อน

      @@programaths Lol, I get you. Although it can be set via the environment variables GOGC and GOMEMLIMIT without otherwise changing code.

  • @iseDaniel
    @iseDaniel 11 หลายเดือนก่อน

    Thank you for this kind of content loko, I really enjoy it.

  • @Mentox2
    @Mentox2 11 หลายเดือนก่อน +2

    You know this was edited by chatGPT when the text feels the need to remind you that this feature is currently experimental and unsupported three times.

  • @dabbopabblo
    @dabbopabblo 11 หลายเดือนก่อน +1

    Props to @acornspits in chat for saying "Don't pee in the pool" when buffer pools were brought up😂😂 That made me laugh harder than it should of

  • @EthanBradley1231
    @EthanBradley1231 11 หลายเดือนก่อน +13

    Fun fact I learned recently: LISP had garbage collection in 1960, 3 years after Fortran was invented and 22 years before C. LISP was also the first language to use a memory heap, so garbage collection actually *is* "traditional memory management."

    • @blue5659
      @blue5659 11 หลายเดือนก่อน +4

      Runtime gc is traditional. Arc, autofree, raii are not

    • @gravisan
      @gravisan 10 หลายเดือนก่อน

      Mark and sweep is kind of garbage (no pun intended) and trivial to implement (there are loops you need to watch out for). There are better algorithms now that don't require 'stop' the world style sweeping.

    • @raytarth6064
      @raytarth6064 10 หลายเดือนก่อน

      ​@@gravisancan you name them (and where they are used), please?

  • @timothyvandyke9511
    @timothyvandyke9511 11 หลายเดือนก่อน +2

    That manual gc stuff you're doing in node is very very very similar to what we're having to do in our maui app in C# because MAUI has memory ISSUES

  • @KonradGM
    @KonradGM 11 หลายเดือนก่อน +2

    Looking into it it looks like something simmilair to ECS principles? It's interesting how much GameDev usually associated stuff can still be utilized in traditional workflows

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  11 หลายเดือนก่อน +4

      very close to the same thing

  • @augustoptsantos
    @augustoptsantos 11 หลายเดือนก่อน +1

    Dmitry Filimonov is the CTO of Pyroscope!! Cool!! Once I helped the company I was working for with Pyroscope. Team loved it. I did too.

  • @banatibor83
    @banatibor83 11 หลายเดือนก่อน

    Looks like a feature which you can benefit the most when you know that you are about to load a huge amount of domain aggregate objects into memory. It is hard to imagine how Go decides which can go into one arena.

  • @ih8tusernam3s
    @ih8tusernam3s 11 หลายเดือนก่อน

    Prime should give classes on stuff; maybe api-gateways, docker, prisma, and other common software?

  • @ScibbieGames
    @ScibbieGames 11 หลายเดือนก่อน +1

    This makes go more attractive for things like gamedev or other general app development

  • @muskyoxes
    @muskyoxes 11 หลายเดือนก่อน

    Historic new paradigm - a chunk of memory that you get to use!

  • @ThePapanoob
    @ThePapanoob 11 หลายเดือนก่อน +1

    I find it quite amusing that were solving problems like its 1999 😄 yes it does help but its literally the same as writing a custom allocator for c. I would even argue that this isnt suited for go as go is meant to be simple and foolproof. This adds quite a few pitfalls to keep in mind

  • @animanaut
    @animanaut 11 หลายเดือนก่อน

    read Jason Gregory's Game Engine Architecture once and it has a chapter on allocators and memory pools. well worth a read that book, but its a chonky tome

  • @Weaseldog2001
    @Weaseldog2001 4 หลายเดือนก่อน

    So this is basically the concept of having specialized heaps in C/C++.
    One of the cool things about computer programming is that we reinvent the wheel, over and over with new tools.

  • @bipinmaharjan4090
    @bipinmaharjan4090 11 หลายเดือนก่อน

    i think we need a video or course on optimizing node applicaiton.

  • @mileniliev5247
    @mileniliev5247 11 หลายเดือนก่อน +2

    We used to call this concept in C++ a memory pool. Looks like it's the same thing or I didn't understand it correctly?

  • @trapexit
    @trapexit 11 หลายเดือนก่อน +10

    Good to see but is a pretty standard solution to this problem. Using fixed type memory pools built on large slabs of preallocated memory is common in C, C++, Java, etc.

    • @JorgetePanete
      @JorgetePanete 11 หลายเดือนก่อน

      Also, Java is getting arenas for interacting with other languages

    • @nathansgreen
      @nathansgreen 11 หลายเดือนก่อน +1

      In Java, most of that magic is done at runtime by a JIT. Getting new escape hatches to have a bit more influence over the runtime behavior while guaranteeing there are no violations of specs defined for the language or the JVM would be a really cool thing to add. Project Panama is still a preview feature in JDK21, so the problem isn't completely solved yet.

  • @jaysistar2711
    @jaysistar2711 11 หลายเดือนก่อน +3

    Yes, Go does have "Stop the world" garbage collection. Erlang does garbage collection as an event, which is local to that event loop. It's about the only version of garbage collection that I thought was manageable.

    • @LtdJorge
      @LtdJorge 11 หลายเดือนก่อน +5

      Yep, Erlang is stop the world, but a single process is an entire world, so only that process gets paused.

    • @jaysistar2711
      @jaysistar2711 11 หลายเดือนก่อน

      @@nosferratu That's true. If you must have a GC, then Go's is one of the best. I still have had to fight it, though, and most of my projects would end up doing so. Therefore, I'm going with Rust. Zig looks nice, though.

  • @likwidsage
    @likwidsage 11 หลายเดือนก่อน

    That sign off was amazing
    -agen

  • @saniel2748
    @saniel2748 11 หลายเดือนก่อน

    I wish every GC collected language had this. In C# one could just spawn a bunch of UI nodes (like in unity's UIToolkit) and be able to delete all of them later

  • @FrederikSchumacher
    @FrederikSchumacher 11 หลายเดือนก่อน

    Okay, so I'm still waiting for when the competition and contention is being explained, and there's some kind of bits and bytes destruction with fitness functions going on. Disappointingly it's just all talk of memory pooling. I mean, I get it, the term memory pools instantly puts sweat on my forehead, all the prerequisites and thought and planning that goes into using a memory pool properly, designing data structures so they can be reused (mutability ugh), fetching and releasing them, dealing with being over limits, resizing strategies. I mean, judging by the explanations and context given here, this sounds like runtime managed memory pools. An improvement on manual pools, but still sounds like pools.

  • @eduardomedeirospereira1811
    @eduardomedeirospereira1811 11 หลายเดือนก่อน

    Interesting... appears to me that someone realizes that "Java Heap Space" is not a bad idea at all ... but I liked a LOT that Go is evolving memory management!

  • @ninjazhu
    @ninjazhu 11 หลายเดือนก่อน

    I think the Go team should get a z80 banked system so they can realise that with banked memory management it is not so dissimilar to arenas, which is a very common memory management paradigm

  • @mai-evan
    @mai-evan 11 หลายเดือนก่อน

    id tune in on twitch if you did some more go stuff

  • @jamesflames6987
    @jamesflames6987 11 หลายเดือนก่อน +2

    I never understood the point of garbage collection. For simple allocations it doesn't provide any benefit and for complex allocations it doesn't do what you want and you need to do some weird tricks to try to make it do the right thing. And all the time there is this mysterious performance killing process going on in the background which is extremely difficult to observe or control. As a C++ programmer I never do manual memory allocation on principal and everything "just works" and is super fast.

    • @isodoubIet
      @isodoubIet 11 หลายเดือนก่อน +1

      Yep my experience with C++ is that value semantics covers what I want 90% of the time, unique ownership 9%, shared ownership 0.9%. The remaining 0.1% is where something like a garbage collector might make sense. That all these languages design their memory systems around the 0.1% case is crazy to me.

    • @geoffclapp5280
      @geoffclapp5280 11 หลายเดือนก่อน +1

      ​@@isodoubIet golang GC is built to safely manage concurrency and I think that's a sane enough reason.

  • @AlessandroArcidiaco
    @AlessandroArcidiaco 11 หลายเดือนก่อน +2

    So now I can decide to use GC only or use this "kind of" manual memory allocation, right?

    • @nightonfir3
      @nightonfir3 11 หลายเดือนก่อน

      If you mean that if you use this the GC doesn't exist anymore. No, you could use this in a single place in your program and everything else would be garbage collected like before.

    • @AlessandroArcidiaco
      @AlessandroArcidiaco 11 หลายเดือนก่อน

      ​@@nightonfir3 thanks, no I mean that I can choose to allocate memory in both manual and GC mode within my application

  • @gracjanchudziak4755
    @gracjanchudziak4755 11 หลายเดือนก่อน

    Maybe it's stupid question but GO with borrow checker is possible?

  • @yzeerkd
    @yzeerkd 11 หลายเดือนก่อน

    Rust has bumpalo for arenas, I wonder if you could write a nodejs package that exposes a rust-based arena interface using Neon

  • @pictureus
    @pictureus 11 หลายเดือนก่อน

    Primeagean moving away from Rust apart from Leptos?
    A couple of months ago it was a lot of praise. Anyway :) Cool that you're exploring different languages, Zig, OCaml etc.

  • @vladimiro3059
    @vladimiro3059 11 หลายเดือนก่อน

    Write code in C++ and use custom memory allocators and RAII, use flyweight pattern.
    How would you flyweight in go😂?

  • @iCrimzon
    @iCrimzon 11 หลายเดือนก่อน +1

    Other than DreamBird, Go is the greatest language to have been concocted by the wizards.

  • @AlexBezhan
    @AlexBezhan 11 หลายเดือนก่อน

    Is it possible to implement arenas in JS? With ArrayBuffer I guess

  • @ryanleemartin7758
    @ryanleemartin7758 11 หลายเดือนก่อน +1

    Leptos is so good that it is the sole reason you continue to use Rust? Damn, that's high praise.

  • @raidensama1511
    @raidensama1511 11 หลายเดือนก่อน

    Leptos and Greg Johnston are great

  • @CTimmerman
    @CTimmerman 11 หลายเดือนก่อน

    12:52 Why pop all the items before nulling their array? If something other than their array held pointers to them, the gc() would not clear them anyway.

  • @alexpyattaev
    @alexpyattaev 11 หลายเดือนก่อน

    Getting this correct without borrow checker will be "fun".

  • @carriagereturned3974
    @carriagereturned3974 11 หลายเดือนก่อน

    "what is this" 00:00 ChatGPT Editor

  • @trapexit
    @trapexit 11 หลายเดือนก่อน +3

    @5:30 Yes, latency from GC is a big issue in most languages. One reason Erlang's GC system is so interesting and why a server in Erlang can have much better overall latency and performance characteristics than other dynamic languages and even compiled languages with GC.
    Working in fintech... the hoops Java devs have jumped through over the years to remove latency is entertaining. At the end of the day they mostly end up doing most of their own memory management after sometimes years of painful rewriting and profiling. Sometimes custom JVMs are needed.

    • @white-bunny
      @white-bunny 11 หลายเดือนก่อน

      Heard words about the Shenandoah GC. What do you think about that?

    • @LtdJorge
      @LtdJorge 11 หลายเดือนก่อน +1

      ​@@white-bunny it should be much better than older GCs, but even if it's included in most JDKs, it's not seeing much adoption I think.
      It will never beat Erlang's tho (or the BEAM's, rather), since in Erlang everything is a process and the GC is per process. So pauses are virtually inexistent.

  • @SpikeTaunt
    @SpikeTaunt 11 หลายเดือนก่อน +1

    I love Go

  • @ulrich-tonmoy
    @ulrich-tonmoy 11 หลายเดือนก่อน

    So we are going form OOP to DOP

  • @Archie3D
    @Archie3D 11 หลายเดือนก่อน

    So, it's like Mark() and Release() we had in Pascal in 80s?

  • @somebody_on_the_internetz
    @somebody_on_the_internetz 11 หลายเดือนก่อน

    I guess wasm does not help you with your node memory problem at Netflix?

  • @ColinFox
    @ColinFox 8 หลายเดือนก่อน

    Wow - what's old is new again. The Amiga had this concept decades ago, called "Memory Pools". You can make and release small allocations out of the pools, and then free the whole pool at once.

  • @nixrohan
    @nixrohan 11 หลายเดือนก่อน

    Go uses a lot of energy

  • @EightSixx
    @EightSixx 11 หลายเดือนก่อน +4

    make more Go content thanks.

  • @victorarnault
    @victorarnault 11 หลายเดือนก่อน

    OCaml for backend projects?

  • @palashdas7006
    @palashdas7006 หลายเดือนก่อน

    If you need frequent memory requirement, why sync.Pool{} ?

  • @jamesflames6987
    @jamesflames6987 11 หลายเดือนก่อน +2

    RAII and smart pointers also eliminate the need for manual memory management with minimal overhead.

  • @TheSulross
    @TheSulross 9 หลายเดือนก่อน

    serious C programming been doing arena memory management approach for decades

  • @logannance10
    @logannance10 11 หลายเดือนก่อน

    Go is the greatest language I've never tried.

  • @ikiris9456
    @ikiris9456 10 หลายเดือนก่อน

    Wait i thought this got pulled / permanent hold due to API issues?

  • @hufuhufu
    @hufuhufu 11 หลายเดือนก่อน

    Clap for greg! Clap Clap Clap

  • @alexroman8878
    @alexroman8878 8 หลายเดือนก่อน

    I really didn’t like Js prototypes before Go. Now I think they’ve brought me a lot of fun compared to boring go syntax(I mean I like go syntax a lot, but not in this case)

  • @morgengabe1
    @morgengabe1 11 หลายเดือนก่อน +2

    I've written a few hundred projects in go and I honestly think this feature will lead to more wasted time than anything. Go needs to change how it allocates memory by having memory semantics. This could be achieved through the type system internals but instead of doing that they add generics and more ways to complicate your memory model. Every problem their generics implementation solves could have been covered by allowing interfaces to specify data, allowing structs to have predefined values (thus omitting the need for interfaces in the first place), or just allowing operator overloads (which would also solve some of the problems the current generics implementation introduced).
    It's crazy to me. They work so god damned hard to solve irrelevant problems. Parametric syntaxes are all you need.

    • @Phasma6969
      @Phasma6969 11 หลายเดือนก่อน

      Is it better to implement what you suggest over using another language? Genuine question, I am a hobbyist and no expert...

    • @morgengabe1
      @morgengabe1 11 หลายเดือนก่อน +2

      @@Phasma6969 oh, i'm a hobbyist too. I wish it wasn't, but admit I've spent a number of afternoons working on different aspects of it, lol. I've tried talking about these sorts of things in the issues but they get no traction over there. Rust almost gets it right, but I just can't be bothered to haggle with a borrow checker. I think the general philosophy is "let unoptimized code run inefficiently" with a dose of "we could manipulate the way data is read instead of mutating the data itself". It's a game of turtles all the way down that begins with kernel specifications. Like browsers. They're basically virtual machines at this point since they run their own assembly code. Why do it that way? I blame microsoft for not having converged to, or generalized, posix. Since then all hell's been breaking loose.

    • @k98killer
      @k98killer 11 หลายเดือนก่อน

      ​@@morgengabe1Winderps is a problem in so many ways. Anyway, I just began experimenting with Go a couple weeks ago and love it except for the quirks with the generics -- having two levels of generics, for example, would require writing wrapper functions for every method of the interface, which is a pain in the ass I don't wanna deal with, so instead I used a wrapper struct with optional members (using an Option struct that has an IsSet boolean member that can be checked and is false by default but gets set to true by a NewOption generic func). I'm sure there are a lot of things I can do to further optimize performance of this genetic algorithm library, but I'm still learning and want to successfully evolve some classifiers first.

    • @dougsaylor6442
      @dougsaylor6442 10 หลายเดือนก่อน +2

      This... makes no sense to me. Arena allocation *is* an addition to memory semantics. Maybe you're talking about something else? And what do generics have to do with arena allocation? Allowing interfaces to specify data would completely change how interfaces work at the most foundational level. That's why you won't be getting any traction in the issues. Operator overloads in languages that support them are routinely used to make code hard to read, because people do silly things with it. I would hate to see that in Go.

    • @morgengabe1
      @morgengabe1 10 หลายเดือนก่อน

      @@dougsaylor6442 arena allocation doesn't achieve anything you couldn't do with arrays and responsible memory management. It's about writing a program that checks the validity of deallocations after SSA is done

  • @lucav.k.7588
    @lucav.k.7588 11 หลายเดือนก่อน +1

    Editor ChatGPT lmao

  •  11 หลายเดือนก่อน +1

    go discovering america

  • @marcusrehn6915
    @marcusrehn6915 11 หลายเดือนก่อน

    Remember when the Java team said that nobody should use reflection? Good thing that nobody does...

  • @NatoBoram
    @NatoBoram 10 หลายเดือนก่อน

    It surprises me that you actually call the GC in node. The only times I tried it, it actually made performance worse.

  • @ThePandaGuitar
    @ThePandaGuitar 11 หลายเดือนก่อน +8

    Golang is probably the greatest language ever made. Small, simple, pragmatic, fast, powerful.

    • @0.Maiden
      @0.Maiden 11 หลายเดือนก่อน

      cc

  • @repe0
    @repe0 11 หลายเดือนก่อน

    Chat gpt as an editor

  • @ejazahmed4609
    @ejazahmed4609 11 หลายเดือนก่อน

    In JS you can also do...
    array.length = 0
    And then call gc. It works in the same way.

  • @jcbritobr
    @jcbritobr 10 หลายเดือนก่อน

    Golang is top language.

  • @i007c
    @i007c 11 หลายเดือนก่อน

    isin't there a max size for each network request like 64k
    can't you just put it in the stack and forgot about it. i mean that what i did in c 😂

  • @LucasSouza-jx4ks
    @LucasSouza-jx4ks 6 หลายเดือนก่อน

    Is go slowly turning into a low level language? Bcz that's what I'm getting from this video

  • @JosifovGjorgi
    @JosifovGjorgi 11 หลายเดือนก่อน

    Young generation GC is part of JVM for 20+ years and you don't have to use any programming to trigger it.
    Easy peasy

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  11 หลายเดือนก่อน +3

      this isn't generation gc stuff (already in go, ts, jvm as you said) this is controlled regions of code where you can clean up 100x objects in a single call.

    • @JosifovGjorgi
      @JosifovGjorgi 11 หลายเดือนก่อน

      @@ThePrimeTimeagen
      After objects from young generation memory area are promoted to different generation (survivors), the jvm will clean up young generation memory area in a single call.

  • @sanderbos4243
    @sanderbos4243 11 หลายเดือนก่อน +1

    Arenas

  • @zahash1045
    @zahash1045 11 หลายเดือนก่อน

    All my homies use rust 🦀🦀

  • @anhta9001
    @anhta9001 11 หลายเดือนก่อน

    A naive mark & sweep garbage collector can even pause for several seconds in extreme cases.

  • @moumous87
    @moumous87 11 หลายเดือนก่อน +2

    There you go… all the Rust foundation shitshow has started to alienate even the Primeagen

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  11 หลายเดือนก่อน +4

      shh, don't tell them
      but this was one of my big "wants" in a GC language. light control over memory where its needed. and boom goes the dynamite, we have it

  • @amatiashevich
    @amatiashevich 11 หลายเดือนก่อน

    Use Rust?

  • @UGPepe
    @UGPepe 11 หลายเดือนก่อน

    wow another 1960s concept making its way into a 2023 language. I guess that's... progress?

  • @laughingvampire7555
    @laughingvampire7555 11 หลายเดือนก่อน

    Garbage Collection as memory management is older than C.

  • @guitaripod
    @guitaripod 11 หลายเดือนก่อน +2

    Go ftw

  • @maruseron
    @maruseron 6 หลายเดือนก่อน

    so java does it and it's a "java finally arrives at 2010 kekw", but go does it and it's a great, awesome, well designed language?

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  6 หลายเดือนก่อน

      yes

    • @maruseron
      @maruseron 6 หลายเดือนก่อน

      @@ThePrimeTimeagen understandable

  • @BanAaron
    @BanAaron 11 หลายเดือนก่อน

    PrimeFeet

  • @fayaz2956
    @fayaz2956 11 หลายเดือนก่อน +2

    I really wanted to give golang a try but not being able to compile my code if I have an unused import or variable is a bummer. The fact that golang team isn't officially introducing a flag or something to be used while debugging the code is saddening. Their stance is "it will make the compile time slower & result in bad code" is childish. Many language compilers remove unused codes when building for production, but treat unused imports/variable a warning instead of an error. But golang is like, "we don't do it here" 😑 not gonna use golang unless they fix that issue. Otherwise sticking with rust and typescript. Thanks to golang team for upsetting so many new golang learners & forcing them to never try golang again 👏

  • @WinterHoax
    @WinterHoax 11 หลายเดือนก่อน

    O

  • @user-bz7gt4zi7r
    @user-bz7gt4zi7r 11 หลายเดือนก่อน

    Htitty :D

  • @nixrohan
    @nixrohan 11 หลายเดือนก่อน

    lol jq