I'm sticking to std::vector until the profiler tells me not to.
-
-
Replying to @stefan_3d @isonno and
Depending on the platform, std::vector doesn’t even implement bounds checking asserts... you cannot safely have one in your public API... and the profiler may not easily reveal where the problem comes to data/noise ratio in cache lines (std::vector is 1/3 ratio)
2 replies 0 retweets 3 likes -
-
Replying to @Reedbeta @stefan_3d and
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.
2 replies 0 retweets 0 likes -
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
If only it was that simple! std::vector will usually at least store data, length, and capacity, so that's 24 bytes already, even if you know the size up-front. But in practice (with gcc at least), it stores start and end pointers, so just getting the count might be a division.
1 reply 0 retweets 0 likes
Yeah sorry, I should have said, "you get _at least_ this bad". But the actual situation could be unboundedly worse depending on the implementation.
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.