summary refs log tree commit diff stats
path: root/lib/pure/collections/sharedtables.nim
Commit message (Collapse)AuthorAgeFilesLines
* complete std prefixes for stdlib (#22887)ringabout2023-10-301-1/+1
| | | | follow up https://github.com/nim-lang/Nim/pull/22851 follow up https://github.com/nim-lang/Nim/pull/22873
* Markdown code blocks migration part 8 (#22478)Andrey Makarov2023-08-151-2/+2
|
* Deprecate `std/sharedlist` and `std/sharedtables` (#19112)konsumlamm2021-11-091-0/+2
|
* workaround bug in sharedtables.withValue to unblock frozen CI on OSX (#18172)flywind2021-06-041-0/+4
|
* Ref #17697 improve withValue docs (#18154)flywind2021-06-031-31/+50
| | | | | * Ref #17697 improve withValue docs * address comments
* use single backtick (#17141)flywind2021-02-211-22/+22
|
* Fulfill https://github.com/nim-lang/Nim/pull/14995#issuecomment-664914391 ↵c-blake2020-07-281-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#15104) request. This can be conceived as an alternate, more capable resolution of https://github.com/nim-lang/Nim/issues/12200 than https://github.com/nim-lang/Nim/pull/12208 The code re-org idea here is to upgrade tablimpl.nim:`delImpl`/`delImplIdx` to abstract client code conventions for cell emptiness & cell hashing via three new template arguments - `makeEmpty`, `cellEmpty`, `cellHash` which all take a single integer argument and clear a cell, test if clear or produce the hash of the key stored at that index in `.data[]`. Then we update the 3 call sites (`Table`, `CountTable`, `SharedTable`) of `delImpl`/`delImplIdx` by defining define those arguments just before the first invocation as non-exported templates. Because `CountTable` does not save hash() outputs as `.hcode`, it needs a new tableimpl.nim:`delImplNoHCode` which simply in-lines the hash search when no `.hcode` field is available for "prefix compare" acceleration. It is conceivable this new template could be used by future variants, such as one optimized for integer keys where `hash()` and `==` are fast and `.hcode` is both wasted space & time (though a small change to interfaces there for a sentinel key meaning "empty" is needed for maximum efficiency). We also eliminate the old O(n) `proc remove(CountTable...)` in favor of simply invoking the new `delImpl*` templates and take care to correctly handle the case where `val` is either zero for non-existent keys in `inc` or evolves to zero over time in `[]=` or `inc`. The only user-visible changes from the +-42 delta here are speed, iteration order post deletes, and relaxing the `Positive` constraint on `val` in `proc inc` again, as indicated in the `changelog.md` entry.
* remove a condition that table size must be passed as power of 2 (#14926)Miran2020-07-081-6/+2
| | | | | | | | | | | | | | | * remove a condition that table size must be passed as power of 2 * remove power-of-2 condition from sets and sharedtables * remove power-of-2 condition from deques * use 'correctSize' for both branches * prettify changelog.md and fix typos * add a changelog entry * fix double-call of 'right-size' * fix the same thing in sets.nim * introduce a new internal proc `slotsNeeded` Deprecate the public proc `rightSize`, which is not needed anymore. Now it is an identity function, allowing the old code to work correctly and without extra allocations.
* Clean out sharedtables (#14858)Juan Carlos2020-06-301-10/+0
| | | Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* change 'iff' to 'if' to stop "corrections" once and for all (#14182)Miran2020-05-011-1/+1
|
* JS unittest stacktrace fix, cleanup js repr and inclrtl includes (#14168)hlaaftana2020-04-301-2/+0
|
* revert stdlib changes which are not required anymoreAndreas Rumpf2020-04-011-8/+10
|
* Hrm, the new errors highlighted some code that seems to be brokenZahary Karadjov2020-04-011-10/+8
| | | | | | New issue: since `Table[A, B]` allocates its backing storage with `newSeq[KeyValuePair[A, B]]`, it's no longer legal to create a table with `not nil` types used as either keys or values.
* Unwind just the "pseudorandom probing" part of recent sets,tables changes ↵c-blake2020-03-311-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#13816) * Unwind just the "pseudorandom probing" (whole hash-code-keyed variable stride double hashing) part of recent sets & tables changes (which has still been causing bugs over a month later (e.g., two days ago https://github.com/nim-lang/Nim/issues/13794) as well as still having several "figure this out" implementation question comments in them (see just diffs of this PR). This topic has been discussed in many places: https://github.com/nim-lang/Nim/issues/13393 https://github.com/nim-lang/Nim/pull/13418 https://github.com/nim-lang/Nim/pull/13440 https://github.com/nim-lang/Nim/issues/13794 Alternative/non-mandatory stronger integer hashes (or vice-versa opt-in identity hashes) are a better solution that is more general (no illusion of one hard-coded sequence solving all problems) while retaining the virtues of linear probing such as cache obliviousness and age-less tables under delete-heavy workloads (still untested after a month of this change). The only real solution for truly adversarial keys is a hash keyed off of data unobservable to attackers. That all fits better with a few families of user-pluggable/define-switchable hashes which can be provided in a separate PR more about `hashes.nim`. This PR carefully preserves the better (but still hard coded!) probing of the `intsets` and other recent fixes like `move` annotations, hash order invariant tests, `intsets.missingOrExcl` fixing, and the move of `rightSize` into `hashcommon.nim`. * Fix `data.len` -> `dataLen` problem.
* tables/sharedtables/intsets/etc: fix #13496, #13504, #13505; add lots of ↵Timothee Cour2020-02-261-0/+5
| | | | | | | | | | | tests (#13498) [backport] * fix #13496 handle tombstones * add test * more tests * fix #13504; add SharedTable tests * fix #https://github.com/nim-lang/Nim/issues/13505 intsets.missingOrExcl silently gave wrong results sometimes * add test for tintsets
* [backport] pseudorandom probing for hash collision (#13418)Timothee Cour2020-02-191-2/+4
|
* last stdlib cleanupsAraq2019-09-211-0/+2
|
* [other] prettify collections (#11695)Miran2019-07-091-4/+4
|
* [bugfix] fix #11588, don't check if SharedTable is initializednarimiran2019-06-261-1/+3
|
* Render deprecated pragmas (#8886)LemonBoy2019-06-031-2/+2
| | | | | | | | | * Render deprecated pragmas * fix the expected html * clean up the documentation regarding deprecations * fix typo * fix system.nim * fix random
* Initialized collections (#11094)Miran2019-04-291-1/+9
| | | | | | | | | | | | * tables: initialized by default * sets: initialized by default * DRY: extract shared functionality * add a changelog entry * fix errors * don't test include files * make it work for sharedtables * fix discovered bugs * add exhaustive tests
* more documentation fixesAraq2018-03-051-5/+7
|
* Fixed mutex usage in SharedList and SharedTable. Closes #6988 (#6990)Yuriy Glukhov2017-12-311-5/+15
|
* improve the docs for tables.addAraq2017-12-121-0/+1
|
* Remove expr/stmt (#5857)Arne Döring2017-07-251-1/+1
|
* Add compute proc for SharedTable (#5385)Ruslan Mustakov2017-03-021-0/+46
|
* Allow compilation of sharedtables.nimcoffeepots2016-09-091-0/+2
| | | tableimpl uses {.oldimmediate.}, which is defined in system/inclrtl.
* fixes a critical tables bug that caused 'enlarge' to crash after 'add'Andreas Rumpf2016-09-051-8/+11
|
* Introduce template withValue()cheatfate2016-05-261-0/+53
|
* prepared selectors module for multi threadingAraq2015-06-301-3/+3
|
* some progress on making async multithreadedAraq2015-05-281-0/+105