flame icon indicating copy to clipboard operation
flame copied to clipboard

Separate debug functionality from the Component class

Open st-pasha opened this issue 3 years ago • 2 comments

What could be improved and why

Currently the Component class has certain debug properties + methods, including

bool debugMode;
Color debugColor;
ValueCache<Paint> _debugPaintCache;
ValueCache<TextPaint> _debugTextPaintCache;

int? get debugCoordinatesPrecision;
Paint get debugPaint;
TextPaint get debugTextPaint;
void renderDebugMode(Canvas canvas);

This is a lot of expensive properties, especially since they are carried for every Component in the game, and are completely unused under normal circumstances.

Now, I do believe that having debug mode, debug capabilities, and debug convenience is very important. However, we should think how to accomplish the same without unnecessarily encumbering the regular use-case.

st-pasha avatar Dec 18 '21 01:12 st-pasha

Which of these properties are expensive? 🤔

spydon avatar Dec 18 '21 11:12 spydon

Color has a complexity of a single int; whereas the two Cache properties contain a pointer and a list each.

st-pasha avatar Dec 18 '21 18:12 st-pasha