-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Run processors on whole of text #16155
Run processors on whole of text #16155
Conversation
There is an inefficiency in the design of our processors which means that Emoji and other processors run in order n^2 time. This PR forces the emoji processors to process the entirety of text node before passing back up. The fundamental inefficiency remains but it should be significantly ameliorated. Signed-off-by: Andrew Thornton <art27@cantab.net>
It's better to add a benchmark. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
480c3c1
to
c17207d
Compare
Benchmark added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
142208659396 ns/op -> 1195548 ns/op
Things can be further improved by not having the processors reprocess text that they have already seen - i.e. track the next sibling and don't do anything till that happens. However that would require more changes to the processor. |
@zeripath this pull as is can be backported ... refactor should be done later :) |
Codecov Report
@@ Coverage Diff @@
## main #16155 +/- ##
==========================================
+ Coverage 44.57% 44.60% +0.03%
==========================================
Files 699 700 +1
Lines 82794 82925 +131
==========================================
+ Hits 36906 36990 +84
- Misses 39906 39946 +40
- Partials 5982 5989 +7
Continue to review full report at Codecov.
|
Backport go-gitea#16155 There is an inefficiency in the design of our processors which means that Emoji and other processors run in order n^2 time. This PR forces the processors to process the entirety of text node before passing back up. The fundamental inefficiency remains but it should be significantly ameliorated. Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport #16155 There is an inefficiency in the design of our processors which means that Emoji and other processors run in order n^2 time. This PR forces the processors to process the entirety of text node before passing back up. The fundamental inefficiency remains but it should be significantly ameliorated. Signed-off-by: Andrew Thornton <art27@cantab.net>
There is an inefficiency in the design of our processors which means that Emoji and other processors run in order n^2 time. This PR forces the processors to process the entirety of text node before passing back up. The fundamental inefficiency remains but it should be significantly ameliorated. Signed-off-by: Andrew Thornton <art27@cantab.net>
There is an inefficiency in the design of our processors which means that Emoji
and other processors run in order n^2 time.
This PR forces all of the processors to process the entirety of text node before passing
back up. The fundamental inefficiency remains but it should be significantly
ameliorated.
Signed-off-by: Andrew Thornton art27@cantab.net