From 73c355176653e5b643f2bbbdc4f967cc24b3ee3b Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 7 May 2011 22:13:24 +0200 Subject: gc tweaking to gain a few percent of performance --- lib/pure/collections/hashtables.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/pure') diff --git a/lib/pure/collections/hashtables.nim b/lib/pure/collections/hashtables.nim index 29ba6bf6f..4f4c4f5a0 100644 --- a/lib/pure/collections/hashtables.nim +++ b/lib/pure/collections/hashtables.nim @@ -216,9 +216,16 @@ proc `[]=`*[A, B](t: TOrderedHashTable[A, B], key: A, val: B) = inc(t.counter) proc del*[A, B](t: TOrderedHashTable[A, B], key: A) = - ## deletes `key` from hash table `t`. + ## deletes `key` from hash table `t`. Warning: It's inefficient for ordered + ## tables: O(n). var index = RawGet(t, key) if index >= 0: + var i = t.first + while i >= 0: + var nxt = t.data[i].next + if nxt == index: XXX + i = nxt + t.data[index].slot = seDeleted dec(t.counter) -- cgit 1.4.1-2-gfad0