Does it occures when you are moving the mouse over the tab drawing area? if so I think I know where the problem is.
Not when moving, but when clicking on it, when giving back focus to a pane, when clicking onto an editor pane that already has the focus for the first time (does not happen the second time), when scrolling tabs, opening editors, etc.
Btw, how did you measure it? did you add debug info? put a break point? etc.
Hahaha, too much trouble... I've simply put a printf("."); into that function and built Code::Blocks as console application.

What I get when anything "happens" to a tab is "......"
I came upon it at all because I did a global file search on
GetTextExtent and found that it is indeed used in many places inside wxFNB (once inside a loop, too).
Just out of curiosity, I put in this
printf into the draw function and saw that it was indeed called surprisingly often.
Since a tab's title is set via an accessor function, it should be trivial to do without all these and make the width a member function that is updated only when needed.
GetTextExtent(_T("Tp"), ...) returns a constant so this could be trivially optimised out, too. I guess then it doesn't matter much how often a function is called any more.
BTW, similar things seem to happen inside Scintilla, for example it recalculates the line number width each time is is drawn (which leads to the question: Does turning line numbers off improve performance?), and it recalculates the font's (constant) ascent value when showing tooltips each time, too. Tooltips aren't shown a hundred times per second, but if it can take hundreds of milliseconds for GetTextExtent to finish, it may be worthwile to cache this too...
Unluckily, global search following the many alias functions inside wxScintilla reveals that it recalculates a lot of text widths in many places (above all, formatting text...

), so rather than fixing one or two hotspots, the only feasible way of fixing things may be to find a
GetTextExtent replacement.
I don't know how it is exactly implemented, however from the documentation, it almost looks like
cairo_scaled_font_text_extents() is really the same as
cairo_show_text(), except for suppressing the actual output.
As a proposed solution, one could call
cairo_scaled_font_glyph_extents() once (once every time the editor font is changed), and on request sum up the
x_advance values of all characters in a string (using
x_bearing for the last character). Summing up one or two dozen doubles from an array should not take any significant amount of time at all.
Anyone here have a deep insight into Cairo and willing to give it a shot?
