Performance question:

I have built the larger portion of a terminal emulator, with rendering happening through cairo.

I'm rendering one character position at a time, which involves setting the background color, filling the character's background, setting the foreground color, and rendering the character itself.

I'm crawling at about 20 FPS when the screen gets large, which is not ideal when scrolling through an editor; any suggestions for how to make this faster? Perhaps cairo is not the right tool for this job...although I am using CPU rendering, so that could be a big improvement to make if I switched to OpenGL or something.

Follow

@philipwhite are you doing any sort of caching? I think, cairo is just vector graphics so it won't do it for you, and a terminal emulator most of the time should be just copying memory(cached renders of glyphs) not constantly re-rendering glyphs. With that I think even the CPU can do 60 fps full-screen with reasonable font size (assuming optimized memcpy). You'd probably need similar setup with opengl as well, because that's the best approach there too (though probably wouldn't be able to reuse any code... so mental setup). The difference is that with CPU the further optimization would be trying to identify and exploit patterns, like consecutive characters, and rendering them in one go, while with GPU you will be mostly optimizing the pipeline, that is figuring out how to update the cache of glyphs that is now in GPU memory without noticeable hiccups.

· · SubwayTooter · 0 · 0 · 0
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.