Patchwork [4,of,7] templater: micro-optimize join() with empty separator

login
register
mail settings
Submitter Yuya Nishihara
Date April 4, 2018, 2:48 p.m.
Message ID <2c73a43fd4dfbc6cbf19.1522853335@mimosa>
Download mbox | patch
Permalink /patch/30260/
State Accepted
Headers show

Comments

Yuya Nishihara - April 4, 2018, 2:48 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1521555388 -32400
#      Tue Mar 20 23:16:28 2018 +0900
# Node ID 2c73a43fd4dfbc6cbf1971cb192d48e74506856d
# Parent  419e9203f95ad088cea54213ddbe892beb4775bd
templater: micro-optimize join() with empty separator

Patch

diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py
--- a/mercurial/templateutil.py
+++ b/mercurial/templateutil.py
@@ -558,6 +558,6 @@  def joinitems(itemiter, sep):
     for x in itemiter:
         if first:
             first = False
-        else:
+        elif sep:
             yield sep
         yield x