]> Sergey Matveev's repositories - public-inbox.git/commit
viewdiff: rewrite and simplify
authorEric Wong <e@yhbt.net>
Sat, 25 Jan 2020 04:45:10 +0000 (04:45 +0000)
committerEric Wong <e@yhbt.net>
Mon, 27 Jan 2020 02:59:09 +0000 (02:59 +0000)
commitddec19694cbf0e1d94fb56c0fc4bd90eae540884
tree67b174dd71519fd5b14f57f2740e41fd3645ffe6
parent19671d5736639c9f5d063a87a075fd309e41d203
viewdiff: rewrite and simplify

Instead of going line-by-line, use split() with a giant regexp
to capture groups of contiguous lines.  This offloads state
management to the regexp itself and makes it FAR easier to
keep track of <span> and </span> pairings.

Performance seems roughly on par after this change for the
meta@public-inbox archives.  It seems a tiny bit faster for
git@vger with xt/perf-msgview.t, likely due to the longer
messages and larger contiguous groups of lines having the same
prefix (or no prefix at all) and drastically reduces the number
of subroutine calls and Perl ops executed.
lib/PublicInbox/View.pm
lib/PublicInbox/ViewDiff.pm