Skip to content

Commit

Permalink
IntMap: Use a set, not a list, for toRemove.
Browse files Browse the repository at this point in the history
This speeds up the tabular report generator running on the main map by
at least an order of magnitude.
  • Loading branch information
kingjon3377 committed Jul 4, 2020
1 parent 466c808 commit 9a5eadb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/lovelace/util/common/DelayedRemovalMap.ceylon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ceylon.collection {
ArrayList,
HashSet,
MutableMap,
MutableList,
MutableSet,
HashMap
}

Expand All @@ -17,7 +17,7 @@ shared interface DelayedRemovalMap<Key, Item> satisfies MutableMap<Key, Item>
shared class IntMap<Item>() satisfies DelayedRemovalMap<Integer, Item> {
MutableMap<Integer, Item> backing = HashMap<Integer, Item>();
// TODO: Use a bitmap?
MutableList<Integer> toRemove = ArrayList<Integer>();
MutableSet<Integer> toRemove = HashSet<Integer>();

"Add all entries in the map to the to-remove list."
shared actual void clear() => toRemove.addAll(backing.keys);
Expand Down

0 comments on commit 9a5eadb

Please sign in to comment.