Optimizing my 2D drawing library

Started by
3 comments, last by Programmer16 18 years, 9 months ago
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.
Advertisement
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.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
I guess I could have thought of that. I'll try that out.
Anybody else?
Namespaces! [smile]
Rob Loach [Website] [Projects] [Contact]
Namespaces? I guess I was talking more of optomizing the code's speed, not its design.

This topic is closed to new replies.

Advertisement