This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: ComposedText vs Label
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
If you do any of your own widgets, there's a good chance you draw text on the screen. There's this venerable old object called ComposedText(1), that if you're like me, is just kind of the guy that's used a lot.
There's this other object called Label(2). It's for single line Paragraphs (er, ComposedTexts) and it's a lot less more powerful. Realistically, Label's all that I probably need 95% of the time. But habits being what they are, I just tend to grab the powerhouse and forget about it after that.
Here's the thing though. I knew that the extra power of ComposedText comes at a price, but I've never really bothered to care or check at what price. So I took a look at it today. I was shocked at just how much faster Label is:
Class
ms to create x 100000
ComposedText
4348
Label
198
That's a factor of nearly 22x! Drawing is also a bit faster.
Class
ms to draw x 10000
ComposedText
2050
Label
512
About 8x faster. The morale is: If you don't need the multiline composition capabilities of ComposedText, don't bother with it. Of course, before you worry about it, make it work, and make it right.
(1) I have never understood why they renamed this from the simple and terse "Paragraph" as it was called in the blue book. Which name do you like better?
(2) It's really too bad that there's not a good "name" one can put on a "displayed text "so that we could draw the terms ComposedText and Label closer together.