Performance of TRVMathItemInfo

General TRichView support forum. Please post your questions here
Post Reply
Vitalii
Posts: 6
Joined: Sat Oct 20, 2018 2:55 pm
Location: Ukraine
Contact:

Performance of TRVMathItemInfo

Post by Vitalii » Sat Jan 26, 2019 10:33 am

Good day!
I noticed that TRVMathItemInfo is significantly slower than the other items. I understand that this is an "external" class and speed depends on rendering algorithm, but loading 100 formulas from a file or stream takes about 20 seconds (in TRichViewEdit). I am developing an application for the scientific field, where the number of formulas can reach hundreds and equations change very often. Is there any solution to increase the speed of work with this class?
Thanks)

Upd. Load operations themselves are fast, but the Format function delays the process.

Vitalii
Posts: 6
Joined: Sat Oct 20, 2018 2:55 pm
Location: Ukraine
Contact:

Re: Performance of TRVMathItemInfo

Post by Vitalii » Thu Jan 31, 2019 10:19 pm

I think I understand what's the matter.

A function GetMathFontName in unit RVMathItem performed on every update of item (recreates font list with TMathTable.EnumMathFonts). Experimentally, I comment this code and try to work with single instance of font list (in initialization / finalization sections). Perhaps I did not take something into account, but this solution works perfect — speed of TRVMathItemInfo increased at times!

Can I recommend this solution to developers? Thanks)
Last edited by Vitalii on Wed May 08, 2019 4:47 pm, edited 1 time in total.

Sergey Tkachenko
Site Admin
Posts: 14400
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Performance of TRVMathItemInfo

Post by Sergey Tkachenko » Thu Feb 28, 2019 2:27 pm

You are right, the list of font names should be made global. Currently, a list of fonts is stored only if TRVMathDocObject is added to TRichView.DocObjects.

I made the changes, they will be included in the next update.

Vitalii
Posts: 6
Joined: Sat Oct 20, 2018 2:55 pm
Location: Ukraine
Contact:

Re: Performance of TRVMathItemInfo

Post by Vitalii » Wed May 01, 2019 6:57 am

Thanks, great!

Post Reply