I am working on a TCP server application. When a message is received, a new instance of an object representing this message is created. À function in the messages handler is then called and this new instance is passed as a parameter. This parameter is of type "IMessage" (interface for message). At that point, i need to identify the Message type.
My question is : in order to have the best performences, should i add à unique identifier in each IMessage instance, like an Int, or should i use instanceof ?