Component Class

Component class
string property “componentName” can be used as both a name and ID
so surly it makes more sense for ComponentID to be declared integer datatype instead of string aswell, so it can be more useful
in situations where function pointers ARRAYS are being used, allowing components to invoke functions/class methods via
this integer index property. Converting string property ComponentID, to integer, causes function call overhead, wasting cpu cycles, so it makes more sense to have atleast 1 integer property, adding another property obviously wastes RAM etc

It’s always useful to bear in mind the 2 rules of optimising when thinking about things like this:

  1. Don’t do it
  2. Don’t do it yet

In light of the second point, can you provide a test case in which this actually shows up in a profiler as being a performance issue?

7 Likes

I would suggest using Identifier for component IDs. Once internalised (i.e. pooled), they are faster to look up and compare than String, e.g. for purposes of mapping callback functions. Actually Identifier was introduced for exactly that purpose.

Integers are best for automated assignment. For manual coding, strings are easier to remember and associate with some meaning.

1 Like