Remix.run Logo
forinti 4 hours ago

So if you need speed, you just have to swallow your OO programmer's pride and put your data in arrays.

jayd16 an hour ago | parent | next [-]

If you have hot loops with millions of iterations at a time, structure your code accordingly. Its not anti-OO to choose the right data structure for the job.

bob1029 2 hours ago | parent | prev | next [-]

And avoid moving said data between physical threads as much as possible.

Most of the bottlenecks I see are not due to the organization of data. Unnecessary communication of data is the #1 offender.

burnt-resistor an hour ago | parent [-]

Working set and algorithm diagonalization (work independence) FTW. Immutable data structures and copying often helps to avoid cache invalidation penalties.

theandrewbailey 3 hours ago | parent | prev [-]

Maybe someone can write an OO language where arrays of structs are automatically stored as structs of arrays.

mild /s

fp64 3 hours ago | parent | next [-]

Odin has some helpers, was one of the more interesting features I found, but never tried. Not sure if you want to consider Odin OO, but well https://odin-lang.org/docs/overview/#soa-struct-arrays

Mizza 3 hours ago | parent | prev | next [-]

Are you talking about Zig's MultiArrayList?

alex7o 3 hours ago | parent [-]

He is talking about jai the programing language from Jonathan Blow, which is quite cool but there is no way to access it.

tlb 3 hours ago | parent | prev [-]

There's a package to do this in Julia: https://juliaarrays.github.io/StructArrays.jl/stable/