Not sure what you're rendering on your display, but here's a couple of ideas, though I have no experience with U8glib
First I don't know if the bottleneck is the Adafruit code or the SPI transfer (presume you're using hardware SPI), I guess it's the CPU from what I've seen. Given this caveat, Adafruit_GFX (via the SSD1306 driver my OLED uses), goes to some lengths to avoid you addressing pixels outside the display, eg drawPixel() which is used heavily, tests your (x,y) coordinate to ensure they're inside the display bounds as well as checking your rotation flag. If you don't need these, you could strip the code to see if it improves things as long as you're careful with clipping etc. You could almost use a debug & release flag to conditionally compile in/out those checks.
In one of my apps, I was displaying lots of text, and this is quite time consuming to render, so I wrote a little utility class that store text strings and their (x,y) coordinates. It would only render a character in the text if it's changed. That made a huge difference to fps (x2 or 3 on an arduino pro mini), eg to GPS lat/long where most digits changed infrequently, though it used up some RAM to do this. I'll post some code in a bit if I can find it, though it may not be too elegant... The crucial thing is not to make the CPU do any more work than is absolutely necessary and use RAM to cache anything you can as there's a fair bit on the Teensy
Found the code, like I said, it's not pretty, note we don't need to delete[] our text(!) - here's the struct:
struct OledItem
{
OledItem(size_t maxTextLen, int x, int y, int textSize, int fgColour, int bgColour)
: m_text(new char[maxTextLen + 1]),
m_x(x), m_y
,
m_textSize(textSize),
m_fgColour(fgColour),
m_bgColour(bgColour)
{
*m_text = '\0';
}
void setText(const char* text)
{
const char* p1 = m_text;
const char* p2 = text;
oled.setTextSize(m_textSize);
oled.setTextColor(m_fgColour, m_bgColour);
int x = m_x;
for(;
{
if (*p1 != *p2)
{
oled.setCursor(x, m_y);
oled.print(*p2);
}
if (*p1 != '\0') p1++;
if (*p2 != '\0') p2++;
if (*p1 == *p2 && *p1 == '\0') break;
x += m_textSize * 6;
}
strcpy(m_text, text);
}
char* m_text;
int m_x;
int m_y;
int m_textSize;
int m_fgColour;
int m_bgColour;
};
To use it, declare your OledItems:
OledItem oiLatitude(13, 4, 49, 1, GREEN, BLACK);
OledItem oiLongitude(13, 4, 59, 1, GREEN, BLACK);
To update the text, do this:
oiLatitude.setText(formatPrintPosition(GPS.latitudeDegrees, GPS.lat));
oiLongitude.setText(formatPrintPosition(GPS.longitudeDegrees, GPS.lon));