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. |
6543
left a comment
There was a problem hiding this comment.
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