amap calls `alength` at every iteration step

Description

During the 1.7 => 1.8 upgrade `areduce` was fixed to not call `alength` on the same thing, at every single iteration step. However, `amap` which suffers from the same issue was not fixed (even though exactly the same fix applies).

Example:

Before (last time): 0.3930 ms
After (last time): 0.3459 ms

Patch: fix_amap.patch

Screened by: Alex Miller

Environment

JVM

Attachments

1

Activity

Show:

Dimitrios Jim Piliouras April 24, 2016 at 8:32 PM

Sure thing, I'll create it now.

Alex Miller April 24, 2016 at 7:48 PM

Separate ticket would be preferred, thanks.

Dimitrios Jim Piliouras April 24, 2016 at 7:33 PM

Not a problem. I actually noticed a very similar thing in the `internal-reduce` implementation for StringSeq [1]. The `.length()` method is called on the same String on every single iteration step, even though it is a constant. Is that easy enough to be sorted without me submitting another trivial patch? Thanks in advance...

https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/protocols.clj#L151

Alex Miller March 13, 2016 at 10:39 PM

Thanks!

Completed

Details

Assignee

Reporter

Approval

Ok

Patch

Code

Priority

Affects versions

Fix versions

Created March 13, 2016 at 3:39 PM
Updated September 6, 2017 at 5:42 PM
Resolved September 6, 2017 at 5:42 PM