Menu

Spark Text Primitives Decision

SourceForge Editorial Staff

Spark Text Primitives Decision

Currently, there are 3 text primitives in Spark: SimpleText, RichText, and RichEditableText. Please see http://opensource.adobe.com/wiki/display/flexsdk/Spark%20Text%20Primitives for more information on this.

As part of the customer usability feedback, we are going to add a Spark Label. This Label control will essentially be a SimpleText built on top of a UIComponent. There are two reasons for this: 1) a customer (new or migrating from Flex 3) expects a Label control 2) Label will work in both Halo and Spark containers.

Based on performance numbers we have already done (see Note 1), we have decided that there is not a big enough performance gain between SimpleText and Label to keep SimpleText around. There are too many concerns with customer usability to adding yet another text primitive. Performance for Label is worse than SimpleText, but in the big picture of a Flex application, this difference turns out to be minimal. Ideally, we would like to take any performance gain we can or else we may wind up getting "nickled and dimed" to death, but because of usability concerns, this nickel turns out to be one we are willing to accept. This also does not back us in to a corner of having to support a component that is only marginally better in terms of performance. In the future, through other text performance gains, we may be able to justify this addition to a confusing set of text primitives, but this will not happen in the Flex 4 time frame.

Performance numbers have also shown that there is little delta between RichText and RichEditableText. We've determined it may be possible to combine RichText and RichEditableText from a performance stand-point, but it is out of scope currently as there are still some issues that need to be worked out, like RichEditableText supporting truncation. Instead, RichText will be made a UIComponent. The performance degredation for making RichText a UIComponent were similar to SimpleText vs Label (around 50 ms lost on 240 RichTexts). We've also determined that we need atleast 2 different text components because there was also a large performance delta between RichText/RichEditableText and SimpleText/Label.

To summarize the decisions we've made:

  1. Replace SimpleText with Label, a UIComponent version of the same component
  2. Instead of extending GraphicElement, RichText will extend UIComponent (like Label will)
  3. All of the spark text components will move to spark.components.*, so there will be spark.components.Label, spark.components.RichText, and spark.components.RichEditableText
  4. The base class for SimpleText and RichText, spark.primitives.supportClasses.TextGraphicElement, will now extend UIComponent (instead of GraphicElement) and be moved and renamed to spark.components.supportClasses.TextBase. All of our text skin parts will now be typed as TextBase instead of TextGraphicElement
  5. For now, RichEditableText and RichText will co-exist. Performance numbers showed that it may be possible to collapse them, but we don't have the time right now to do this. We will revisit this later on, time permitting.

These decisions are not easy, and performance is a big concern, but it has to be weighed against customer usability.

If you have any other thoughts or concerns on the matter, please comment on this wiki page. The contributors and approvers will be monitoring it.

Note 1: The summary of the performance numbers:

  • Creating 240 SimpleTexts took 120 ms before and 167 ms afterwards (about a 40% increase).
  • 1000 Flex 4 Buttons took about 2745 ms vs. 2646 ms (3% increase).
  • Performance difference for a Flex 4 List (with virtualization) was mostly lost in the noise.
  • Creating 240 SimpleTexts took 6.46 MB before and 6.73 MB afterwards (a 270 KB increase or a 4% increase)
  • Creating 1000 Buttons took 41.83 MB before and 42.66 MB afterwards (a 830 KB difference or a 2% increase)
  • Memory difference for a Flex 4 list (with virtualization) was mostly indistinguishable


Related

Wiki: Flex 4

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.