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

People

Vote (11)
Watch (6)

Dates

  • Created:
    Updated: