Fast Vector Class

Started by
5 comments, last by stylin 18 years, 5 months ago
I took the time to write my own vector class. After making a small demo that used it, the demo ran like someone had shot it in the foot. After profiling the code, I find that it's my vector class that's limping along. I found a few classes in teh articles section, now I'm wondering if anyone has their own vector classes they'd be willing to share that they know are fast.
[size=2]Darwinbots - [size=2]Artificial life simulation
Advertisement
I haven't used it myself, but the MTL is said to be uber fast.

Programmer's Reference
Performance Tests

Open source, too.
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
I have never had the need to implement my own vector class, but perhaps if you post some more details about your own implementation and profiling results, I can help you optimize it.

First I guess, what operations are giving you trouble, and how do you use the vector? That is, are you seeing something like deletion taking up most of the clock cycles, or resizing, or (insert operation here)?

Second, how are you implementing your vector? Is it backed by a plain array? How do you handle resizing, deleting, and the other non-trivial operations?
Are we talking about vector as in std::vector or as in 3D vector?
I'm talking about 3D vector, I guess I should have made that clear at the start...
[size=2]Darwinbots - [size=2]Artificial life simulation
The MTL that stylin posted sounds pretty interesting. You can use a matrix to control the implementation of vectors. The vector class I wrote up is currently being used in the SDL.NET project. The vector class itself can be found here in C#. Enjoy!
Rob Loach [Website] [Projects] [Contact]
Quote:Original post by Rob Loach
The MTL that stylin posted sounds pretty interesting. You can use a matrix to control the implementation of vectors.

They also have an Iterative Template Library that handles solving linear systems. What's interesting is their claim of equal or surpassing performance levels with that of some Fortran implementations.
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid

This topic is closed to new replies.

Advertisement