[PATCH] diff performance: re-establish linear runtime performance
Yuya Nishihara
yuya at tcha.org
Fri May 1 11:32:13 UTC 2020
On Thu, 30 Apr 2020 21:10:44 +0200, Elmar Bartel wrote:
> > If the number of intermediate objects matters, creating a list of
> > bytes might be slightly faster.
> >
> > lines = []
> > for hr, hl in hunks:
> > lines.extend(hl)
> > b''.join(lines)
> Might be!
> I've not investigated this variant.
> But I've taken a look at this variant:
>
> text = b''.join(line for hrange, hlines in hunks for line in hlines)
>
> The runtime did not show any significant change.
> And I'd assume the same for the variant with the explicit loop.
> So its more a question of taste - and then I'd prefer one of the
> two one-liners.
Okay. Since it's close to the release and this patch looks strictly better
than the original implementation, I've queued it for stable. Thanks!
Next time, please include some performance number in commit message.
More information about the Mercurial-devel
mailing list