discord / SimpleAST

Extensible Android library for both parsing text into Abstract Syntax Trees and rendering those trees as rich text.
Other
371 stars 32 forks source link

Filter nested skipping rule at earlier time #4

Closed DefiPanda closed 4 years ago

DefiPanda commented 6 years ago

For now we are checking the nested rule setting on every pass, which can result in empty cycles. Since all these can be determined beforehand, we can just get a pre filtered rule list.

It is not a bottleneck of the performance at all. But it is a low hanging fruit to push performance faster in the case there are larger number of passes. With my change I ran the profiling with test string **test*case*zero**one**two**three**four** and see the average time from parsing went down from 547.56s to 542.02s. (a very small ~1.01% improvements).

Also clean up some codes I saw along the way. Please let me know if any of these make sense. Thanks!

DefiPanda commented 6 years ago

updated. thanks for the review!

would you mind take another look? thanks!

lytefast commented 6 years ago

This LGTM. @angarron ?

lytefast commented 4 years ago

Closing this PR since we've changed the way we parse to pass in the rules to the parser in 5f7a383cb8009e8c5a38a878a2c92499d8c9c151.