Added support for ref type hash tables.
This reuses the hash table implementation for objects (and the associated tests). For efficiency reasons, iterator implementations are currently adapted rather than calling the TTable code.
This commit is contained in:
parent
05712fe805
commit
79891b6b9b
3 changed files with 414 additions and 1 deletions
20
tests/table/ptables2.nim
Normal file
20
tests/table/ptables2.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
discard """
|
||||
output: '''true'''
|
||||
"""
|
||||
|
||||
import tables
|
||||
|
||||
proc TestHashIntInt() =
|
||||
var tab = newTable[int,int]()
|
||||
for i in 1..1_000_000:
|
||||
tab[i] = i
|
||||
for i in 1..1_000_000:
|
||||
var x = tab[i]
|
||||
if x != i : echo "not found ", i
|
||||
|
||||
proc run1() = # occupied Memory stays constant, but
|
||||
for i in 1 .. 50: # aborts at run: 44 on win32 with 3.2GB with out of memory
|
||||
TestHashIntInt()
|
||||
|
||||
run1()
|
||||
echo "true"
|
||||
Loading…
Add table
Add a link
Reference in a new issue