The guy who tried this at EA didn't last long there.
Facebook's std::vector optimization
61–70 of 93 posts
Re: Facebook's std::vector optimization
#62Earlier quoted context omitted.
I solved an "realloc is really costly" problem by ditching the memory-is-contiguous notion, paying a little more (really just a few cycles) for each access rather than spending tons of time shuffling stuff around in memory. This eliminated nearly all reallocations. The extra bit of computation was invisible in the face of cache misses. I'm guessing that most customers of std::vector don't really need contiguous memor…
No, that's quite intentional. If you don't need contiguous memory, you can consider using std::deque. http://www.cplusplus.com/reference/deque/deque/
The implementation of std::deque I just read uses a circular queue, resized to a power of two upon growth. It would exhibit the same bad performance as std::vector.
Re: Facebook's std::vector optimization
#63Show me a programmer who is trying to reoptimize the STL, and I'll show you a programmer who is about to be laid off. The guy who tried this at EA didn't last long there.
Re: Facebook's std::vector optimization
#64Are there benchmarks, speedup? Seems strange to leave out that information or did I just miss it?
Re: Facebook's std::vector optimization
#65Earlier quoted context omitted.
Actually, game companies as well as various indie developers have widely distributed this knowledge. Some examples of places to look/things to search for implementations or similar/better: -GDC Slide Decks -Game Programming Data Structure/Performance Books -Game Industry Publications - ex: Game Programming Gems -EA STL -Game Dev Sites -Any available source to various engines/games in the last many years should have m…
http://lmgtfy.com/?q=std%3A%3Avector+games
Re: Facebook's std::vector optimization
#66Show me a programmer who is trying to reoptimize the STL, and I'll show you a programmer who is about to be laid off. The guy who tried this at EA didn't last long there.
Re: Facebook's std::vector optimization
#67Earlier quoted context omitted.
But * * has an entirely different meaning in C/C++.
Only as a prefix operator; * has a pointer-related meaning for prefix and an arithmetic meaning for infix, there's no reason * * shouldn't be the same.
Re: Facebook's std::vector optimization
#68Earlier quoted context omitted.
It's likely to distinguish it from XOR, which is the carat operator in many programming languages.
It is still weird. * * is the other established convention used for exponentiation in languages like Python, Ada, m4, and others.
Re: Facebook's std::vector optimization
#69Re: Facebook's std::vector optimization
#70Solving the equations suggest a fibonacci like sequence, seeded by something like "2, 3, 4, 5". Continuing 9, 14, 23 etc.