How can I increase W5500 data transfer speed when hooked up to an ESP32?

I'm facing an issue when trying to display a webpage through Ethernet in a setup that combines an ESP32 with a W5500 chip.

The wiring is pretty simple and straight forward (ESP32 SPI are wired directly to W5500 SPI , common GND, and powered by 3.3V) and it obviously works since both WiFi and Ethernet are being assigned an IP address and I can ping them both successfully.

I actually have been using this setup for quite some time now but only when I started trying to display a somewhat hefty webpage did I begin to notice some issues.

Basically, all webpage resources are stored in SPIFFS. And, as you'd expect, when a client ( browser ) sends GET requests to retrieve a certain script or page, the below code handles it:

void serve_file(Client *client, char* file_name, char* content_type) {

File webFile;
webFile = SPIFFS.open("/" + String(file_name));

Serial.println("Now sending: " + String(file_name));

client->println("HTTP/1.1 200 OK");
client->println("Content-Length: " + String(webFile.size()));
client->println("Content-Type: " + String(content_type));
client->println("Connection: close");
client->println();

if (webFile) {
    while (webFile.available()) {
        int num_bytes_read;
        unsigned char byte_buffer[1024];
        num_bytes_read = webFile.read(byte_buffer, 1024);
        client->write(byte_buffer, num_bytes_read);
    }
    webFile.close();
}

}

Now, I've been having no issues whatsoever displaying basic webpages using this code. Recently, I tried displaying a webpage with some charts and a certain colorful design, which didn't require huge additional resources, just a couple of .css and .js libraries amounting to ~500 KB. Surprisingly, it was awfully slow loading the webpage through Ethernet, taking ~2.5 secs overall.

To make sure that it wasn't my code causing this, I tried displaying the same webpage using the same code but through WiFi, and it was much faster ( 0.8 - 1.2 secs) which is a speed that is kinda expected through WiFi.

Also, I noticed that when loading the webpage through Ethernet,a lot of times some resources would not load properly causing the page to crash:

|500x14

To make sure, again, that this was not due to a bug in my code, I tried displaying the webpage through WiFi and refreshing it 100s of times. Not once did the page crash or a resource fail to load.

This is where I started suspecting that this may be due to some issues with SPI connection speed, or sync between the ESP32 and W5500. Since I'm no expert when it comes to hardware, all I could do was play around a little with SPI clock speed from within the code which made no difference except when I decreased it a lot ( the webpage would take ages to load ).

Can anyone please assist with this? I am working on a project and I don't want this to take me forever to solve.

set expiration for static files https://github.com/jandrassy/Regulator/blob/master/Regulator/WebServer.ino

Have you had any success with speeding up the ESP32 W5500 ?