Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request improves the
demojize
performance. I have replace the big regular expression with a search tree. The method_get_search_tree()
creates the tree once on first use. I have put an example of a tree in the comment of_get_search_tree()
The
get_emoji_regexp()
still exists but it is unused now.Performance is faster on my machine for both single emoji and a long text. This is approximately how much faster it is on my machine:
I have also added
emojize(language='alias')
as an alternative toemojize(use_aliases=True)
.When someone uses
emojize(language='de', use_aliases=True)
or any other language then 'en', a warning is shown:(I could remove this change to the aliases part, it is not connected to the performance at all)