title: Python 3.5 vs. 3.6 what made "map" slower compared to comprehensions
body: <p>I sometimes used <code>map</code> if there was a function/method that was written in C to get a bit extra performance. However I recently revisited some of my benchmarks and noticed that the relative performance (compared to a similar list comprehension) drastically changed between Python 3.5 and 3.6.</p>
  
  <p>That's not the actual code but just a minimal sample that illustrates the difference:</p>
  
  <pre><code>import random
  
  lst = [random.randint(0, 10) for _ in range(100000)]
  assert list(map((5).__lt__, lst)) == [5 &lt; i for i in lst]
  %timeit list(map((5).__lt__, lst))
  %timeit [5 &lt; i for i in lst]
  </code></pre>
  
  <p>I realize that it's not a good idea to use <code>(5).__lt__</code> but I couldn't come up with a useful example right now.</p>
  
  <p>The timings on Python-3.5 were in favor of the <code>map</code> approach:</p>
  
  <pre><code>15.1 ms ± 5.64 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
  16.7 ms ± 35.6 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
  </code></pre>
  
  <p>While the Python-3.6 timings actually show that the comprehension is faster:</p>
  
  <pre><code>17.9 ms ± 755 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
  14.3 ms ± 128 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
  </code></pre>
  
  <p>My question is what happened in this case that made the list-comprehension faster and the <code>map</code> solution slower? I realize the difference isn't that much, it just made me curious because that was one of the "tricks" I sometimes (actually seldom) used in performance critical codes.</p>