Ticket #2156 (closed bug)

Opened 11 years ago

Last modified 11 years ago

"Insert RTF.." is very slow and throws an exception.

Reported by: kyli Owned by:
Priority: major Milestone:
Component: uncategorized Version: 2.0
Keywords: Cc:
Category: unknown Effort:
Importance: Ticket_group:
Estimated Number of Hours: 0 Add Hours to Ticket: 0
Billable?: yes Total Hours: 0
Analysis_owners: kyli Design_owners: kyli
Imp._owners: kyli Test_owners:
Analysis_reviewers: meddle Changelog:
Design_reviewers: meddle Imp._reviewers: meddle
Test_reviewers: Analysis_score: 4
Design_score: 4 Imp._score: 4
Test_score: 0

Description

  1. Try to insert a RTF frame with a large resource (for example, the attached file).
  2. Notice that the importing is very slow.
  3. After some time, an exception is thrown.

Attachments

As We May Think.rtf (69.3 KB) - added by kyli 11 years ago.
exception.txt (320.6 KB) - added by kyli 11 years ago.

Change History

Changed 11 years ago by kyli

Changed 11 years ago by kyli

comment:1 Changed 11 years ago by kyli

  • Status changed from new to s1b_analysis_finished

comment:2 Changed 11 years ago by kyli

  • Status changed from s1b_analysis_finished to s2a_design_started

comment:3 Changed 11 years ago by kyli

  • Status changed from s2a_design_started to s3b_implementation_finished

Design

  • The slow part is because the text is parsed into lots of elements, each of them forms a HotText, then the texts are merged. Appending a hot text to another one is a relatively slow operation, so for big texts it becomes an issue. What we can make here is to accumulate the texts in a StringBuilder and then make the text at once. Unfortunately, applying a style is also slow, but applying one by one cannot be avoided. However, this operation will become visibly faster.
  • The exception occurs because the TextAlign is not hashable. It is generally not a problem, but trying ti hash a text with this attribute will fail. So, for this concrete file, the exception is normal. It is enough to implement Hashable and override the only one method there - the hash of the align can be constructed by its name and its class.
  • In order to test the rtf insert, I found out that with moving the rtf functionality, some extensions are lost - the rtf menu item and the import manager. They will be registered again in the text module.

Implementation

The code is committed in branches/private/kyli/2156/.

comment:4 Changed 11 years ago by meddle

  • Design_owners set to kyli
  • Status changed from s3b_implementation_finished to s3c_implementation_ok
  • Imp._owners set to kyli
  • Analysis_reviewers set to meddle
  • Analysis_score changed from 0 to 4
  • Imp._reviewers set to meddle
  • Design_score changed from 0 to 4
  • Design_reviewers set to meddle
  • Imp._score changed from 0 to 4

Merged with the trunk at [8071]... Copy paste of RTF does not keep the styles, but it is not from your code...

And write your name in the fields

4p

comment:5 Changed 11 years ago by deyan

  • Status changed from s3c_implementation_ok to closed

Batch update from file query-10.csv

Note: See TracTickets for help on using tickets.