Programming languages without garbage collection send us down a long path of design decisions that lead to slow compile times and fragile runtime performance cliffs.
-
-
So now when we want to recover performance, we need to write all containers and their operations using an increasingly elaborate set of templates or generic functions, which the compiler must specialize for each type at significant cost. This is what C++ and Rust do.
Prikaži ovu nit -
Or we can create a very clunky wrapper like array_of_anything that is used wherever generic types are required, which manually casts and converts values among types dynamically each time it’s accessed. Java generics did this and they were awful.
Prikaži ovu nit -
But if we have garbage collection, we can store our large data structures once with whatever type is required, then dynamically create wrappers that reinterpret it as any subtype that’s required. We pay the cost of GC and indirect control flow for accessors but that’s all.
Prikaži ovu nit -
Unfortunately, most languages missed this opportunity. The C family including C# and Java are overly imperative and lost variance due to wrongly-scoped mutability. And functional languages have generally chosen type systems lacking subtypes, covariance, and contravariance.
Prikaži ovu nit
Kraj razgovora
Novi razgovor -
-
-
Sir, I wanna learn AI?
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
D as betterC doesn't have GC because the runtime isn't linked. You still get slices and you can cast a slice of ubyte[] to a slice of int[] if that's what you want. Or cast each set of bytes to an int. You can't use inbuilt append without GC, to be sure https://dlang.org/spec/betterc.html …
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
Uh, what? This has nothing whatever to do with garbage collection.
- Još 2 druga odgovora
Novi razgovor -
-
-
Or you can enable optimizations and see what any mainstream compiler generates using registers, without local stack allocation. Arrays are not why non-GC languages/compilers are so slow
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
Try telling that to my trash hoarding neighbor
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.