Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math conversions are really slow #144

Closed
skalee opened this issue Mar 13, 2021 · 6 comments · Fixed by #148
Closed

Math conversions are really slow #144

skalee opened this issue Mar 13, 2021 · 6 comments · Fixed by #148
Assignees

Comments

@skalee
Copy link
Contributor

skalee commented Mar 13, 2021

Profiling revealed that TermBuilder#mathml_to_asciimath and TermBuilder#html_to_asciimath which are called from several places take 51% of total concepts generation time (see attachment), mostly due to their use of Nokogiri (41% of total).

I suspect that even simple regular expression test on presence of MathML/HTML tags so that content without math is not processed will make a huge difference. Furthermore, replacing Nokogiri with something else can make a difference too.

Zrzut ekranu 2021-03-13 o 18 38 05

@skalee skalee self-assigned this Mar 13, 2021
@ronaldtse
Copy link
Member

@skalee we have copied of the 'fake math conversion' code to here:
https://github.com/metanorma/stepmod-utils/blob/728bd50bf609afd6c7ef0a6848f45a8419a57819/lib/stepmod/utils/html_to_asciimath.rb

And this is probably time to extract out this 'fake math conversion' functionality to a separate gem under the Plurimath umbrella. Can you help with that? Thanks.

@skalee
Copy link
Contributor Author

skalee commented Mar 15, 2021

@ronaldtse Sure. Please add me to plurimath organization then. How to name that gem? Fake Math? HTML Math? Also, can I assume that things under stepmod-utils are more up to date and feature-complete?

@ronaldtse
Copy link
Member

@skalee done. The fake math handling in stepmod-utils may be more up-to-date because there may be some additional issues handled there. Can you confirm @w00lf ?

Maybe we can call the gem "html2math"?

@skalee
Copy link
Contributor Author

skalee commented Mar 15, 2021

Since I wasn't adding anything in iev-data yet, that's probably true. Stupid question from me.

@ronaldtse
Copy link
Member

The only changes were metanorma/stepmod-utils@d8f3e17.

@skalee
Copy link
Contributor Author

skalee commented Mar 15, 2021

Converter should be moved to a separate gem (see: #149). Any further performance improvements should be made there. Processing is already twice as fast thanks to #148.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants