Clojure

Use transient map in zipmap

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Vetted

Description

#'zipmap constructs a map without transients, where transients could improve performance.

Approach: Use a transient map internally, along with iterators for the keys and values. A persistent map is returned as before. The definition is also moved so that it resides below that of #'transient.

Performance:

expression unpatched patch applied  
(def xs (range 16384)) (zipmap xs xs) 4.329635 ms 2.818339 ms large map
(def ys (range 16)) (zipmap ys ys) 3.803683 us 3.412992 us small map

Patch: CLJ-1005-zipmap-iterators.patch

Screened by:

  1. 0001-Use-transient-map-in-zipmap.2.patch
    15/Aug/12 10:40 AM
    2 kB
    Michał Marczyk
  2. 0001-Use-transient-map-in-zipmap.patch
    30/May/12 2:55 AM
    1 kB
    Michał Marczyk
  3. 0002-CLJ-1005-use-transient-map-in-zipmap.patch
    14/Sep/14 12:48 PM
    2 kB
    Michał Marczyk
  4. CLJ-1005-zipmap-iterators.patch
    22/Sep/14 9:58 AM
    2 kB
    Ghadi Shayban

Activity

Rich Hickey made changes -
Field Original Value New Value
Approval Vetted [ 10003 ]
Fix Version/s Release 1.5 [ 10150 ]
Aaron Bedra made changes -
Approval Vetted [ 10003 ] Incomplete [ 10006 ]
Michał Marczyk made changes -
Attachment 0001-Use-transient-map-in-zipmap.patch [ 11428 ]
Michał Marczyk made changes -
Attachment 0001-Use-transient-map-in-zipmap.patch [ 11428 ]
Michał Marczyk made changes -
Andy Fingerhut made changes -
Approval Incomplete [ 10006 ]
Stuart Halloway made changes -
Fix Version/s Release 1.5 [ 10150 ]
Fix Version/s Release 1.6 [ 10157 ]
Aaron Bedra made changes -
Comment [ Is there a reason why the function moved inside of core.clj? ]
Aaron Bedra made changes -
Comment [ Never mind. I just took a look and realized that transient wasn't available yet. Sorry. ]
Aaron Bedra made changes -
Assignee Michał Marczyk [ michalmarczyk ] Aaron Bedra [ aaron ]
Aaron Bedra made changes -
Affects Version/s Release 1.6 [ 10157 ]
Alex Miller made changes -
Approval Triaged [ 10120 ]
Affects Version/s Release 1.6 [ 10157 ]
Affects Version/s Release 1.5 [ 10150 ]
Fix Version/s Release 1.6 [ 10157 ]
Alex Miller made changes -
Labels performance
Rich Hickey made changes -
Approval Triaged [ 10120 ] Vetted [ 10003 ]
Michał Marczyk made changes -
Ghadi Shayban made changes -
Attachment CLJ-1005-zipmap-iterators.patch [ 13356 ]
Alex Miller made changes -
Assignee Aaron Bedra [ aaron ]
Alex Miller made changes -
Priority Major [ 3 ] Critical [ 2 ]
Erik Assum made changes -
Description The attached patch changes zipmap to use a transient map internally. The definition is also moved so that it resides below that of #'transient. The original definition is commented out (like that of #'into). The attached patch changes zipmap to use a transient map internally. The definition is also moved so that it resides below that of #'transient. The original definition is commented out (like that of #'into).

*Approach:* Use a transient map internally, along with iterators for the keys and values. A persistent map is returned as before.

*Patch:* CLJ-1005-zipmap-iterators.patch

*Screened by:*
Erik Assum made changes -
Description The attached patch changes zipmap to use a transient map internally. The definition is also moved so that it resides below that of #'transient. The original definition is commented out (like that of #'into).

*Approach:* Use a transient map internally, along with iterators for the keys and values. A persistent map is returned as before.

*Patch:* CLJ-1005-zipmap-iterators.patch

*Screened by:*
#'zipmap constructs a map without transients, where transients could improve performance.

*Approach:* Use a transient map internally, along with iterators for the keys and values. A persistent map is returned as before. The definition is also moved so that it resides below that of #'transient.

*Patch:* CLJ-1005-zipmap-iterators.patch

*Screened by:*
Erik Assum made changes -
Description #'zipmap constructs a map without transients, where transients could improve performance.

*Approach:* Use a transient map internally, along with iterators for the keys and values. A persistent map is returned as before. The definition is also moved so that it resides below that of #'transient.

*Patch:* CLJ-1005-zipmap-iterators.patch

*Screened by:*
#'zipmap constructs a map without transients, where transients could improve performance.

*Approach:* Use a transient map internally, along with iterators for the keys and values. A persistent map is returned as before. The definition is also moved so that it resides below that of #'transient.

*Performance:*
|| expression || unpatched || patch applied || ||
| (def xs (range 16384)) (zipmap xs xs) | 4.329635 ms | 2.818339 ms | large map
| (def ys (range 16)) (zipmap ys ys) | 3.803683 us | 3.412992 us | small map

*Patch:* CLJ-1005-zipmap-iterators.patch

*Screened by:*

People

Vote (11)
Watch (6)

Dates

  • Created:
    Updated: