| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes issue with CountTableRef and getOrDefault:
```{nimrod}
import tables
proc main() =
const testKey = "TESTKEY"
let t: CountTableRef[string] = newCountTable[string]()
# Before, does not compile with error message:
#test_counttable.nim(7, 43) template/generic instantiation from here
#lib/pure/collections/tables.nim(117, 21) template/generic instantiation from here
#lib/pure/collections/tableimpl.nim(32, 27) Error: undeclared field: 'hcode'
echo "Count of " & testKey & " is " & $t.getOrDefault(testKey)
t.inc(testKey,3)
echo "Count of " & testKey & " is " & $t.getOrDefault(testKey)
when isMainModule:
main()
```
Previously, `getOrDefault` for CountTableRef objects was calling the
`getOrDefaultImpl` template, which used the t.data.hcode object -
assuming a Table or similar object. Because CountTableRef didn't have
an hcode in its data tuples, this wouldn't compile. Changed to be the
same as `CountTable#getOrDefault`.
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
lib/pure/collections/critbits.nim
lib/pure/collections/tables.nim
lib/pure/xmltree.nim
lib/system/sets.nim
tests/collections/ttables.nim
tests/collections/ttablesref.nim
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- In sets, tables, strtabs, critbits, xmltree
- This uses the new var parameter overloading
- mget variants still exist, but are deprecated in favor of `[]`
- Includes tests and fixed tests and usages of mget
- The non-var `[]` now throws an exception instead of returning binary 0
or an empty string
|
| |
| |
| |
| | |
#2664
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
doc/tut1.txt
lib/core/locks.nim
lib/pure/collections/tables.nim
lib/pure/selectors.nim
|
| | | |
|
| | | |
|
|/ / |
|
| | |
|
|\ \
| | |
| | | |
merge for CountTable, see #1680
|
| | | |
|
| |/ |
|
|/
|
|
|
| |
- Didn't go through all modules, only the main ones I thought of
- Building the compiler and tests still work
|
| |
|
| |
|
|
|
|
| |
overriden
|
|
|
|
| |
Fixes an error with mpairs iterator which was introduced with 5fbcf93860. This is used by nimforum thats why I found it. I also added a testcase for the mpairs iterator.
|
|\ |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Extract maybe re-hash/re-search and insert logic into a new template.
Use this new template to do impl templates for all three put forms
(which required renaming a couple 'value' arguments to 'val').
Added OrderedTable and OrderedTableRef versions of both as well.
|
| | |
|
|/
|
|
| |
pattern of either updating or initializing table entries.
|
| |
|
|\ |
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make similar changes to those made in sets.nim, including hcode, rightSize
rawGet/rawGetKnownHC result protocol, nextTry probe sequence to be the cache
friendlier h=h+1 which in turn allows supporting changing deletion to fix the
infinite loop bug with local rehashing which in turn has desirable properties
of graceful table aging when deletes do happen and also making insert-only
usage patterns no longer pay any time/space cost to check deleted status.
Unlike collections.sets, this module has add() for duplicate key inserts and
a 3rd type of table, CountTable. The first wrinkle is handled by introducing
a rawGetDeep for unconditionally adding entries along collision chains. This
point of CountTable seems to be space efficiency at 2 items per slot. These
changes retain that by keeping the val==0 => EMPTY rule and not caching hash
codes. putImpl is expanded in-place for CountTable since the new putImpl() is
too different. { Depending on table size relative to caches & key expense,
regular Table[A,B] may become faster than CountTable, especially if the basic
count update could be something like inc(mGetOrPut(t, key, 0)). }
Unit tests pass, but in this module those are much more of just a demo than
probing for bugs. Should exercise/test this a little more before merging.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
Misc docs suggestions
|
| |
| |
| |
| | |
This reverts commit bde9d1ac0753e46c726dc63930539bb82d09f19d.
|
| | |
|
| | |
|
|/ |
|
|
|
|
|
|
| |
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.
|