[Python-Dev] PEP 487: Simpler customization of class creation

Raymond Hettinger raymond.hettinger at gmail.com
Mon Jun 20 22:17:00 EDT 2016


> On Jun 20, 2016, at 5:41 PM, Tim Delaney <timothy.c.delaney at gmail.com> wrote:
> 
> Although not a Jython developer, I've looked into the code a few times.
> 
> The major stumbling block as I understand it will be that Jython uses a ConcurrentHashMap as the underlying structure for a dictionary. This would need to change to a concurrent LinkedHashMap, but there's no such thing in the standard library. The best option would appear to be https://github.com/ben-manes/concurrentlinkedhashmap.
> 
> There are also plenty of other places that use maps and all of them would need to be looked at. In a lot of cases they're things like IdentityHashMap which may also need an ordered equivalent.

If you can, check with Jim Baker.  At the language summit a few years ago, he and I sketched out a solution that he thought was doable without much effort and without much of a performance hit.   IIRC, it involved using a ConcurrentHashMap augmented by an auxiliary 2-by-n-row array of indices (one for forward links and the other for backward links).  There was also need to add a reentrant lock around the mutating methods.


Raymond Hettinger



More information about the Python-Dev mailing list