I need to draw a dynamic overlay on a QImage . Overlay components are defined in XML and parsed on QHash<QString, QPicture> , where QString is the name (for example, "crosshairs") and QPicture is a QPicture -independent drawing. Then I draw overlay components as they are needed at the position defined at runtime.
Example: I have 10 photos in my QHash that make up every possible element in a HUD. During a certain frame of the video, I need to draw 6 of them in different positions on the image. During the next frame, something changed, and now I just need to draw 4 of them, but 2 of these positions have changed.
Now to my question: if I try to do this quickly, should I redefine my QHash as QHash<int, QPicture> and list the keys to counteract the overhead caused by string comparisons; or comparisons will not affect performance very much? I can easily convert to whole keys, because the XML parser and overlay composer are completely separate classes; but I would like to use a consistent data structure in the application.
Should I overcome my desire for consistency and reuse in order to increase productivity? Will it even be very important if I do this?
source share