Performance of TRVMathItemInfo

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

Performance of TRVMathItemInfo

Post by Vitalii »

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: 61
Joined: Sat Oct 20, 2018 2:55 pm

Re: Performance of TRVMathItemInfo

Post by Vitalii »

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: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Performance of TRVMathItemInfo

Post by Sergey Tkachenko »

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: 61
Joined: Sat Oct 20, 2018 2:55 pm

Re: Performance of TRVMathItemInfo

Post by Vitalii »

Thanks, great!
Post Reply