[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > FWIW, I'm the original author and designer of this code, so it would have > been appropriate to assign this to me for sign-off on any proposed changes. Not me (the C implementation)? ;-) --

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, I'm the original author and designer of this code, so it would have been appropriate to assign this to me for sign-off on any proposed changes. -- assignee: -> rhettinger ___

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please stop revising every single thing you look at. The traditional design of LRU caches used doubly linked lists for a reason. In particular, when there is a high hit rate, the links can be updated without churning the

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread INADA Naoki
INADA Naoki added the comment: I found odict.pop() and odict.popitem() is very inefficient because it look up key multiple times. odict seems not optimized well and very slow than dict in some area... I'll try to optimize it in holidays. --

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread INADA Naoki
INADA Naoki added the comment: Hmm, it seems my implementation is 30% slower when many mishit scenario. Maybe, dict is faster than OrderedDict about massive insert/discard. But I need to profile it. On the other hand, GC speed looks about 2x faster as expected. $

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- stage: -> resolved status: open -> closed ___ Python tracker ___

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ah, sorry, you use OrderedDict instead of just ordered dict. It should have different timing and memory consumption. -- resolution: duplicate -> stage: resolved -> status: closed -> open superseder: Implement

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a duplicate of issue28239. -- nosy: +serhiy.storchaka resolution: -> duplicate superseder: -> Implement functools.lru_cache() using ordered dict ___ Python tracker

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-23 Thread INADA Naoki
INADA Naoki added the comment: Current implementation (no news entry yet): https://github.com/methane/cpython/pull/10/files -- ___ Python tracker

[issue32422] Make OrderedDict can be used for LRU from C

2017-12-23 Thread INADA Naoki
New submission from INADA Naoki : Currently, functools.lru_cache implement own doubly-linked list. But it is inefficient than OrderedDict because each link node is GC object. So it may eat more memory and take longer GC time. I added two private C API for OrderedDict