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 feedback://showreport?report_id=25533 for the code.

A longer thread discussing the issues can be found here: https://forum.xojo.com/761-please-fix-extraordinarily-slow-parser-for-rtfdata

Version 1 was very buggy, so I’ve uploaded version 2 which actually works, at least some of the time :slight_smile:
See feedback://showreport?report_id=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:
feedback://showreport?report_id=33588
and
feedback://showreport?report_id=33587