From 47549aa3d10808c063d45dcaa598887dadde59c5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 7 Feb 2023 12:28:35 -0700 Subject: compat: Enable the cache benchmark This should have been done back in 8aa12d3 (struct.go: Cache structIndexes, 2023-01-26) --- internal/jsonstruct/struct.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/jsonstruct') diff --git a/internal/jsonstruct/struct.go b/internal/jsonstruct/struct.go index 830dc80..16c45de 100644 --- a/internal/jsonstruct/struct.go +++ b/internal/jsonstruct/struct.go @@ -37,6 +37,10 @@ func IndexStruct(typ reflect.Type) StructIndex { return ret } +func ClearCache() { + structIndexCache = typedsync.CacheMap[reflect.Type, StructIndex]{} +} + // indexStructReal is like indexStruct, but is the real indexer, // bypassing the cache. func indexStructReal(typ reflect.Type) StructIndex { -- cgit v1.2.3-2-g168b