Reduce cost of ThreadLocal(s) to improve Jython performance

Description

Classpath's implementation of ThreadLocal(s) is expensive for get operations. The DaCapo Jython benchmark holds the state of the runtime in a thread local and uses it frequently (nearly every python operator) to make decisions, amongst other things, about adaptive compilation. The Classpath implementation of ThreadLocal(s) is to use a WeakHashMap, so every ThreadLocal get turns into a WeakHashMap get, which makes the cost of operators in python considerably more expensive. We should switch from using a WeakHashMap for ThreadLocal variables to using a simpler data structure such as an array.

Environment

None

Status

Assignee

Unassigned

Reporter

Ian Rogers

Labels

None

Fix versions

Affects versions

Priority

High
Configure