Thread overview |
---|
November 26, 2018 cachetools v.0.0.1 | ||||
---|---|---|---|---|
| ||||
Hello, I released cachetools - package with @safe and @nogc cache and hashtable implementations. It inherits nogc propery from key toHash and opEquals methods and can store immutable keys and values (with restrictions). Currently implemented only LRU cache with TTL. http://code.dlang.org/packages/cachetools https://github.com/ikod/cachetools Performance of underlying hash table seems to be better in my benchmarks in comparison with std associative arrays and with emsi containers (see https://github.com/ikod/cachetools/tree/master/testhash ) Test inserts and lookups int[int] ================================= |std | 303 ms, 541 μs, and 3 hnsecs | GC memory Δ 41MB| |c.t. | 181 ms, 173 μs, and 2 hnsecs | GC memory Δ 0MB| |c.t.+GC | 184 ms, 594 μs, and 5 hnsecs | GC memory Δ 16MB| |emsi | 642 ms and 120 μs | GC memory Δ 0MB| Test insert, remove, lookup for int[int] ======================================= |std | 327 ms, 982 μs, and 1 hnsec | GC memory Δ 17MB| |c.t. | 229 ms, 11 μs, and 7 hnsecs | GC memory Δ 0MB| |c.t.+GC | 240 ms, 135 μs, and 4 hnsecs | GC memory Δ 16MB| |emsi | 678 ms, 931 μs, and 9 hnsecs | GC memory Δ 0MB| Test inserts and lookups for struct[int] ======================================= |std | 468 ms, 411 μs, and 7 hnsecs | GC memory Δ 109MB| |c.t. | 392 ms, 146 μs, and 1 hnsec | GC memory Δ 0MB| |c.t.+GC | 384 ms, 771 μs, and 5 hnsecs | GC memory Δ 88MB| |emsi | 1 sec, 328 ms, 974 μs, and 9 h | GC memory Δ 0MB| ... Thanks for bugreports and proposals. |
January 11, 2019 cachetools v.0.1.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to ikod | Hello, v.0.1.1 released. Significant changes since previous announce: Caches: 1. added 2Q cache. 2Q is more advanced strategy than plain LRU. It is faster, scan-resistant and can give more cache hits. 2. For LRU cache implemented per-item TTL in addition to global TTL. Containers: 1. Added unrolled double-linked lists. Unrolled lists are much faster than plain double-linked lists. Unrolled lists used for 2Q cache implementation. 2. HashMap - code cleanup, use core.internal.hash: bytesHash for strings. Cachetools is set of cache strategies and containers. Caches and containers are @safe and @nogc (inherits from key and value properties). Project page: https://github.com/ikod/cachetools docs: https://ikod.github.io/cachetools/ Some performance test results: https://github.com/ikod/cachetools/tree/master/testhash |
July 17, 2019 Re: cachetools v.0.1.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to ikod | Hello cachetools version 0.2.1 released Changelog: OrderedHashMap added to containers, copy constructors added to containers addIfMissed interface added to HashMap's What is it? cachetools - package with @safe and @nogc cache and hashtable implementations. It inherits nogc propery from key toHash and opEquals methods and can store immutable keys and values (with restrictions). Currently inplemented: caches: LRU, 2Q containers: HashMap, OrderedHashMap, unrolled list, dlist, slist Project page: https://github.com/ikod/cachetools docs: https://ikod.github.io/cachetools/ Some performance test results: https://github.com/ikod/cachetools/tree/master/testhash |
August 13, 2019 Re: cachetools v.0.3.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to ikod | Hello cachetools version 0.3.1 released Changelog: "Set" container added (based on hashtable) Const-ness problems for hashtable fixed. What is it? cachetools - package with @safe and @nogc cache and containers implementations. It inherits @nogc and @safe property from key toHash and opEquals methods and can store immutable keys and values (with restrictions). Currently implemented: caches: LRU, 2Q (with TTL) containers: HashMap, OrderedHashMap, unrolled list, dlist, slist, set Project page: https://github.com/ikod/cachetools docs: https://ikod.github.io/cachetools/ Some performance test results: https://github.com/ikod/cachetools/tree/master/testhash |
August 13, 2019 Re: cachetools v.0.3.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to ikod | On Tuesday, 13 August 2019 at 09:34:48 UTC, ikod wrote:
> Hello
>
> cachetools version 0.3.1 released
>
[...]
Looking at your performance numbers, I am wondering should your work in the end result in a better std AA implementation?
Regards mt.
|
August 13, 2019 Re: cachetools v.0.3.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Tschierschke | On Tuesday, 13 August 2019 at 10:12:45 UTC, Martin Tschierschke wrote:
> On Tuesday, 13 August 2019 at 09:34:48 UTC, ikod wrote:
>> Hello
>>
>> cachetools version 0.3.1 released
>>
> [...]
> Looking at your performance numbers, I am wondering should your work in the end result in a better std AA implementation?
>
> Regards mt.
I'm not sure if I can say too much here. And I can be wrong, but looks like std AA allocate table bucket entry on every insert. This can hurt performance when you have mixed insert/lookup use case. If this is the case then fix will require rewrite of AA code.
Thanks and regards,
Igor
|
August 13, 2019 Re: cachetools v.0.3.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to ikod | On 13.08.19 11:34, ikod wrote: > What is it? > > cachetools - package with @safe and @nogc cache and containers implementations. [...] > Project page: https://github.com/ikod/cachetools > docs: https://ikod.github.io/cachetools/ They don't seem to actually be @safe. An example: ---- import cachetools.containers.lists; import std.stdio; void main() @safe { DList!int dl; dl.insert_first(42); auto r = dl.range; dl.clear(); writeln(r.front); /* Prints garbage, because it's accessing `free`d memory. */ } ---- As far as I can I see, that compiles because you have a bad @trusted here: <https://github.com/ikod/cachetools/blob/ac72aafe979e2f95a343eb9d19b1b67915e4fc17/source/cachetools/containers/lists.d#L391>. Other containers probably have similar problems. |
August 13, 2019 Re: cachetools v.0.3.1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | On Tuesday, 13 August 2019 at 17:18:23 UTC, ag0aep6g wrote: > On 13.08.19 11:34, ikod wrote: >> What is it? >> >> cachetools - package with @safe and @nogc cache and containers implementations. > [...] >> Project page: https://github.com/ikod/cachetools >> docs: https://ikod.github.io/cachetools/ > > They don't seem to actually be @safe. An example: > > ---- > import cachetools.containers.lists; > import std.stdio; > void main() @safe > { > DList!int dl; > dl.insert_first(42); > auto r = dl.range; > dl.clear(); > writeln(r.front); /* Prints garbage, because it's accessing `free`d memory. */ > } > ---- > > As far as I can I see, that compiles because you have a bad @trusted here: Probably this @trusted is not a problem (std.container.dlist also contain @trusted code). I mistakenly ignored this case. Thanks for your report, and I'll create issue on github. > <https://github.com/ikod/cachetools/blob/ac72aafe979e2f95a343eb9d19b1b67915e4fc17/source/cachetools/containers/lists.d#L391>. > > Other containers probably have similar problems. |
Copyright © 1999-2021 by the D Language Foundation