Clojure

Speed up dissoc on array-maps

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: Release 1.5
  • Fix Version/s: Release 1.8
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Ok

Description

The method PersistentArrayMap.without() first searches for a matching key using indexOf(key) and saves the result in i.

If a matching key was found, the code then copies the old array to the new smaller one, but unnecessarily repeats the comparison of every key in the map to the key being removed, even though its location is already stored in i.

Approach: Remove the unnecessary comparison.

Patch: clj-1295-2.patch

Screened by: Alex Miller

  1. clj-1295-1.diff
    15/Nov/13 7:05 PM
    1 kB
    Andy Fingerhut
  2. clj-1295-2.patch
    09/Oct/15 8:45 AM
    2 kB
    Alex Miller

Activity

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: