New issue 2100: sum(map(foo)) is much slower than for loop https://bitbucket.org/pypy/pypy/issues/2100/sum-map-foo-is-much-slower-than-for-loop
Elliot Gorokhovsky: Hi, I originally had the following code: ``` #!python sum(map(lambda x_bit, y_bit: x_bit & y_bit, x, reversed(y))) ``` It was extremely slow, I profiled it at more than 82 sec for an input that called it a few hundred thousand times. I then changed it, at the recommendation of [stack overflow](http://stackoverflow.com/questions/31639519/optimizing-python-one-liner/31639699#31639699), to this: ``` #!python s = 0 for i,j in zip(x, reversed(y)): s += i & j ``` This profiled at about 12 sec on the same input. Why can't the JIT accelerate sum and map operations? I shoudln't have to explicitly write them out. _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue