Optimizing my 2D drawing library
A couple of weeks ago I started working on a 2D library and I've almost finished it. I know that I shouldn't optimize prematurely, but I plan on using this library in a lot of future projects and releasing it for others to use. My question is, would the data manipulation code be much faster if I programmed it in assembly?
I won't be locking memory or anything of that sort, I just have an array of data that I either create or load from a file. I then manipulate it. After that I can copy it to a texture for rendering
An example of usage is my GUI. I load the GUI skin into surface A, and create a surface/texture(B & C) combo (A is CDataSurface, B is CDataSurface, and C is IDirect3DTexture9*.) Then I copy parts from A to B, then all of B to C. Then I render C.
For something that you'll be releasing to others, it's almost imperative that you use a profiler of some sort. A profiler lets you see which sections of your code run the slowest, so you can know where and how to optimize. It can be built in to your library and surrounded by "#ifdef _DEBUG / #endif"'s, or external. I recommend internal.
In this case, running the profiler will probably tell you that this section of your library uses some of the least CPU time as compared to others.
In this case, running the profiler will probably tell you that this section of your library uses some of the least CPU time as compared to others.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement