Say you have your data structure (i.e. a scene object) where you have a bunch of fields as std containers (I.e. points, indices, normals...), all of your pointers to access data are interleaved with data you may actually never need, such as the buffer capacity.
-
-
In the middle of your algorithm you may end up pulling multiple cache lines, just to access your buffers instead of just one.
2 replies 0 retweets 0 likes -
Maybe I'm misunderstanding you - are you talking about SOA vs AOS?
1 reply 0 retweets 0 likes -
Replying to @stefan_3d @maxliani and
No, he's talking about the fact that std::vector does not let you control how the pointer and count are determined and where they are stored, which are two things you absolutely care about if you care about performance.
2 replies 0 retweets 3 likes -
Replying to @cmuratori @stefan_3d and
A proper generic programming library would let you say things like "I have eight arrays, and I want the counts to all come first and then the pointers to all come second". std of course can't do this, because the designers of the language don't understand performance.
1 reply 0 retweets 1 like -
Replying to @cmuratori @stefan_3d and
So you want this: int64 Count[8]; void *Data[8]; but with std::vector you get this int64 Count0; void *Data0; int64 Count1; void *Data1; ... Now you go to access elements of your data arrays, and you never need to check the counts in that code, but you paid for the cache line.
3 replies 0 retweets 3 likes -
Replying to @cmuratori @stefan_3d and
It's just way #382 out of 59,453 that C++ makes the slow way to do things the default "recommended" way to do things :( Basically all of std is like this. It's all bad design that shouldn't be used in the first place, let alone reused.
2 replies 0 retweets 2 likes -
Replying to @cmuratori @maxliani and
One size fits all tool will never fit anyone perfectly. How should a faster alternative to std::vector look like then? Implementing an array that fits your specific need is one thing, but I'm having a hard time imagining a faster generic version.
2 replies 0 retweets 0 likes -
Replying to @stefan_3d @maxliani and
C++ is too poorly designed of a language to have really anything generic that works well, IMO. This is why I don't really do much generic programming in C++. You have two choices: generic and slow, or not-generic and fast :)
1 reply 1 retweet 1 like -
Replying to @cmuratori @stefan_3d and
My preference would have been for the C++ Committee to have actually taken performance seriously and designed the appropriate metaprogramming system (ie., NOT templates, which are terrible) so that things like "counts first, pointers second" were easy to achieve generically.
1 reply 0 retweets 1 like
It's not hard to do, you just have to have designers of the language who appreciate the need to have the generic part of the system be _controllable_, rather than just doing whatever the compiler happens to want, because performance criteria change over time as CPUs evolve.
-
-
Replying to @cmuratori @stefan_3d and
@chandlerc1024@jfbastien@incomputable do you have any thoughts on this?0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.