Speed up dissoc on array-maps

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

Environment

None

Attachments

2
  • 09 Oct 2015, 02:45 PM
  • 16 Nov 2013, 01:05 AM

Activity

Show:

Alex Miller October 9, 2015 at 2:45 PM

Added -2 patch that increases diff context lines, no semantic changes, attribution retained.

Alex Miller December 8, 2014 at 7:07 PM

There will be a second ticket for maps, both will be targeted for 1.8.

Ghadi Shayban December 8, 2014 at 5:43 PM

I dunno, seems like https://clojure.atlassian.net/browse/CLJ-1517#icft=CLJ-1517 phase 1 is just vectors not maps, so this is still easy low-hanging fruit.

Andy Fingerhut December 8, 2014 at 5:10 PM

Always happy to be obsoleted by something even better

Ghadi Shayban December 8, 2014 at 3:47 PM

A nice boost, but probably obsoleted by https://clojure.atlassian.net/browse/CLJ-1517#icft=CLJ-1517

Completed

Details

Assignee

Reporter

Approval

Ok

Patch

Code

Priority

Affects versions

Fix versions

Created November 16, 2013 at 1:01 AM
Updated October 13, 2015 at 3:37 AM
Resolved October 13, 2015 at 3:37 AM