Slow refresh rate on I2C OLED screen I'm trying to create a small handheld console with 6 buttons and an I2C 0.96" OLED display:
https://imgur.com/a/AKiRMWN

The directional buttons use the analog pin and different resistors technique to save space while the two remaining buttons use a digital pin each.
However, despite using the same libraries as other projects, the sketch seems to run very slowly, resulting in a lowered screen refresh rate.

Here is the code:

#define wid 64  // Defines half of the width of the screen for graphic reference
#define hei 32

#include &lt;Adafruit_GFX.h&gt;
#include &lt;Adafruit_SSD1306.h&gt;
Adafruit_SSD1306 display;  // Create display

int av;
const float sp = 3;
float pos[2]={0,0};  // Cursor position

void setup() {
   delay(100);  // Gives the screen time to setup
   display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // Initialize display with the I2C address of 0x3C
   display.clearDisplay();
   display.setTextColor(WHITE);
   display.display();   // Clears the screen of any remaining images
  }

void loop() {
  av=analogRead(A0);  // Reads the directional input
  av=inputRefine(av); // Assigns it to a direction
  switch (av)         // Changes the cursor position accordingly
  {
    case 1:
    pos[1]-=sp;
    break;

    case 2:
    pos[0] += sp;
    break;

    case 3:
    pos[1] += sp;
    break;

    case 4:
    pos[0] -= sp;
    break;
  }
  display.clearDisplay();

  display.setCursor(5,5);
  display.print(millis());  // Prints the system time on the corner of the screen

  display.drawCircle(wid + pos[0], hei + pos[1], 5, WHITE);  // Draws a circle on the cursor position
  display.display();
  }

int inputRefine(int av)
{
  int a=0;
  if (av&gt;500&amp;&amp;av&lt;600) a=2;
  else if(av&gt;1000) a=3;
  else if(av&gt;920&amp;&amp;av&lt;950) a=4;
  else if(av&gt;680&amp;&amp;av&lt;720) a=1;

  return a;
}


What is slowing the execution down?

EDIT: Even commenting out any unnecessary line doesn't remove the lag
EDIT 2: The problem might reside in the screen itself. Unfortunately, I don't have a backup one. I'll order one as soon as possible and test this theory.
Solved by updating the Adafruit sdd1306 library and the Adafruit GFX library

EDIT: Why am I being downvoted?