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:

(def xs (range 16384))
(def ys (range 16))

expression 1.7.0-beta3 +patch  
(zipmap xs xs) 4.50 ms 2.12 ms large map
(zipmap ys ys) 2.75 us 2.07 us small map

Patch: CLJ-1005-zipmap-iterators.patch

Screened by: Alex Miller

  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 (12)
Watch (6)

Dates

  • Created:
    Updated: