Generic Custom Component with arduino code ; why is it so slow?

hello ,

i started to re-use arduino code and placed it in a .h file in esphome.
i only started my concept and already have some issues :frowning:

why do i have these log-messages that my code is to slow ?
and how can i avoid this ??

[13:36:11][W][component:204]: Component custom_component took a long time for an operation (0.11 s).
[13:36:11][W][component:205]: Components should block for at most 20-30ms.

my include file customvith.h :

#include "esphome.h"

class MyCustomComponent : public Component {
 public:
 
 
 
  void setup() override {
    // This will be called once to set up the component
    // think of it as the setup() call in Arduino
    pinMode(5, INPUT);
    pinMode(26, OUTPUT);
	
	  Serial.begin(19200 ,  SERIAL_8N2 , 16 , 17); // opens serial port, sets data rate to 9600 bps
  Serial.setTimeout(100); // set new value to 100 milliseconds
  }
  
  
  
  
  void loop() override {
    // This will be called very often after setup time.
    // think of it as the loop() call in Arduino
    if (digitalRead(5)) {
      digitalWrite(26, HIGH);

      // You can also log messages
      ESP_LOGD("custom", "The GPIO pin 5 is HIGH!");
    }
	
	else

    {
      digitalWrite(26, LOW);
       ESP_LOGD("custom", "The GPIO pin 5 is LOW!");
      }
	  
	  
	  
	  
	    // check if data is available
  if (Serial.available() > 0) {
    // read the incoming string
    String incomingString = Serial.readString();
    // prints the received data
    Serial.print("I received: ");
    //Serial.println(incomingString);
    char hexArray[incomingString.length() * 2 + 1]; // Allocate memory for the char array
    for (int i = 0; i < incomingString.length(); i++) {
      sprintf(hexArray + i * 2, "%02x", incomingString[i]); // Convert each character to hexadecimal
    }
    hexArray[incomingString.length() * 2] = '\0'; // Add null terminator to the char array

    Serial.println(hexArray); // Print the converted hexadecimal values
 ESP_LOGD("custom", "RECIEVED something  , now i need to proces it here in this .h file !");

  }  
  }
};

Several components have this error.
This is a new warning in the logs.

Allocating memory on the heap at each loop is expensive.
Try to comment out your Hex debugging to see if it makes a difference.