Slotcar lapcounter using macro ICACHE_RAM_ATTR on ESP-01 WiFi Module

Hello there,

It is my first project with Arduino on the ESP-01 bord.

I'm trying to use ESP-01 as a lapcounter in my digital slotcar track.
It is basicly a log of level changes handled by interrupt-routines and
sent via WiFi to my computer, where I detect, make up and display the results.
I was quite happy to get it run, but unfortunately there are a very few events missing,
which is of course not acceptable during race.
I assume, they are lost because of handling the interrupts during WiFi comunications.

I stoped working on it for a while, but then I found hints using the 'ICACHE_RAM_ATTR'-Macro.
for shifting the code into different RAM having a better performance.

Can somebody help me to get this done?

When I insert 'ICACHE_RAM_ATTR' at my sketch, I get a message like:

... was not declared in this scope.

Thank you in advance!

Here is my Code:

#include <ESP8266WiFi.h>

const char* ssid = "GP-Alsterdorf";
const char* password = "";                         // "" = kein Passwort erforderlich

int Ereigniszaehler = 1;
long int StartMicros;
String AntwortLog = "";
String Header = "";
String Komando = "";

WiFiServer server(80);                             // erzeuge eine Instanz des Servers auf Port 80

void setup() 
{
 
  // Ein/Ausgabe Pins vorbereiten
  pinMode(0, OUTPUT);
  pinMode(1, INPUT_PULLUP);                        //Empfängerdiode Rechte Spur (Anschlußbezeichnung TXD) 
  pinMode(2, OUTPUT);                              //Spannungsversorgung der Lichtschranken in den Slots 
  digitalWrite(2,1);                               //Spannungsversorgung der Lichtschranken in den Slots ausschalten
  pinMode(3, INPUT_PULLUP);                        //Empfängerdiode Linkee Spur (Anschlußbezeichnung RXD)
  attachInterrupt(digitalPinToInterrupt(1), InterruptroutineRechteSpur, CHANGE); 
  attachInterrupt(digitalPinToInterrupt(3), InterruptroutineLinkeSpur, CHANGE); 
  
  delay(1);
  
  // AccessPoint einrichten
  WiFi.mode(WIFI_AP);
  WiFi.softAP(ssid, password);
  server.begin();

}

void loop() 
{ 
  
  
  WiFiClient client = server.available();          // Prüfe, ob Client verbunden ist
  if (!client) {return;}
  yield();

  
  Komando = client.readStringUntil('\r');          // Komandostring vom Client lesen
  
  if (Komando.indexOf('CLEAR') != -1){             // Falls Komandostring 'CLEAR' enthält 
    AntwortLog = "";                               // Daten im AntwortLog löschen
  }
   
  if (Komando.indexOf('GO') != -1) {               // Falls Komandostring 'GO' enthält
    AntwortLog = "";                               // Daten im AntwortLog löschen
    StartMicros = micros();                        // us-Zählerstand merken
    Ereigniszaehler = 1;                           // Ereigniszaehler initialisieren
    digitalWrite(2,0);                             // Spannungsversorgung für Lichtschranken in den Slots einschalten
  }

  client.flush();                                  // Warten bis alle Zeichen gesendet wurden 
  yield();  
     
  Header  = "HTTP/1.1 200 OK\r\n";                 // Formatierung des Headers für Antwort an Client
  Header += "Content-Length: ";
  Header += AntwortLog.length();                   // Länge des AntwortLog einfügen
  Header += "\r\n";
  Header += "Content-Type: text/html\r\n";
  Header += "Connection: close\r\n";
  Header += "\r\n";

  yield();

  client.print(Header);                            // Antwort-Header senden
  client.print(AntwortLog);                        // AntwortLog senden

  client.stop();                                   // Client stoppen
}

//void InterruptroutineLinkeSpur() {
void ICACHE_RAM_ATTR InterruptroutineLinkeSpur() {
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                  Verarbeitung eingehender Pegeländerungen am Eingang GPIO 3  (linke Spur)                      //
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    AntwortLog += Ereigniszaehler; 
    AntwortLog += ",L,"; 
    AntwortLog += micros() - StartMicros; 
    AntwortLog += ","; 
    AntwortLog += digitalRead(3); 
    AntwortLog += "\r";
    Ereigniszaehler ++;
}
    
void InterruptroutineRechteSpur() {    
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                  Verarbeitung eingehender Pegeländerungen am Eingang GPIO 2  (rechte Spur)                     //
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    AntwortLog += Ereigniszaehler; 
    AntwortLog += ",R,"; 
    AntwortLog += micros() - StartMicros; 
    AntwortLog += ","; 
    AntwortLog += digitalRead(1); 
    AntwortLog += "\r";
    Ereigniszaehler ++;
}