using System.Collections.Generic; using System.Threading; namespace Jint.Native.Array { /// /// Helper to cache common data structures needed in array access on a per thread basis. /// internal class ArrayExecutionContext { // cache key container for array iteration for less allocations private static readonly ThreadLocal _executionContext = new ThreadLocal(() => new ArrayExecutionContext()); private List _keyCache; private ArrayExecutionContext() { } public List KeyCache => _keyCache = _keyCache ?? new List(); public static ArrayExecutionContext Current => _executionContext.Value; } }