RTFUtils : fixes slow StyledText.RTFData performance

I’m happy to report I’ve uploaded version 1 of a module which works around the performance bugs in StyledText.RTFData, using a combination of my code and the declares from Massimo. Please see <https://xojo.com/issue/25533> for the code.

A longer thread discussing the issues can be found here: Please fix extraordinarily slow parser for RTFData - General - Xojo Programming Forum

Version 1 was very buggy, so I’ve uploaded version 2 which actually works, at least some of the time :slight_smile:
See https://xojo.com/issue/25533

2014-05-18 Version 3
Many changes:

  • Alignment (left, center, right) is now determined from the Paragraph settings and properly saved and restored in RTF data
  • The Paragraph() function turns out to be a major bottleneck, so we’ve re-written it as ParagraphsFast()

Performance Tests - note that these tests now properly handle Paragraph-level alignment

Test results with 8KB of RTF text, run from within IDE:

Time (msec)

Method FromRTF ToRTF

Xojo Native 15000 91000
StyledText 49 33000*
TextArea 49 3

  • When operating directly on StyledText objects, this class still has to use the very slow Paragrap(indx) call.
    So, if it all possible, it’s much faster to do this:

TextaArea1.RTFDataFast = rtf

rather than this:

TextArea1.StyledText.RTFDataFast = rtf

Watch:

1 None Parsing RTF data is incredibly slow Fixed 000019

(25533 - Parsing RTF data is incredibly slow)

Yes, Joe seems to be working on it. See also:
<https://xojo.com/issue/33588>
and
<https://xojo.com/issue/33587>