I'm making a chat window. It's text may be hundreads of lines. I'm worrying about the performance. The text may append frequently, the string concatenating may be slow, and I'm not sure whether rendering such a large text(clipped by a small rect) may be slow or not.
Any good ideas about dealing with large texts?
deal with a large text?
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: deal with a large text?
As always the answer is, it depends... It sounds like you're using a multiline editbox for the chat history, which could be a poor choice. Generally people chose a Listbox of some kind for this, with each line being it's own item. Using this approach, I believe, the non-visible strings (listbox items) are rejected quickly, so you may get better performance overall. There's also the possibility of managing the text yourself and setting a sub-string to be drawn rather than the entire text, I've not tried this and it sounds expensive
Also be aware that in the 0.6.x and earlier releases, rendering large amounts of text can be expensive due to the nature of what the text is, and how it's represented from a geometry point of view. Typically a 'page' of text results in many tens of thousands - even hundreds of thousands - of triangles to be drawn, which clearly has an impact on performance. We have reduced this issue in the upcoming 0.7.0 release by allowing content to be cached to texture first, meaning that after the first render of any amount of text in a suitably initialised window, it's only ever two triangles (the only time it would not give better performance is if you were modifying the text many times each second - which given your description, you will not be (generally, people don't type that quickly!).
CE.
Also be aware that in the 0.6.x and earlier releases, rendering large amounts of text can be expensive due to the nature of what the text is, and how it's represented from a geometry point of view. Typically a 'page' of text results in many tens of thousands - even hundreds of thousands - of triangles to be drawn, which clearly has an impact on performance. We have reduced this issue in the upcoming 0.7.0 release by allowing content to be cached to texture first, meaning that after the first render of any amount of text in a suitably initialised window, it's only ever two triangles (the only time it would not give better performance is if you were modifying the text many times each second - which given your description, you will not be (generally, people don't type that quickly!).
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: No registered users and 12 guests