summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-02-07 12:28:35 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-02-07 14:05:48 -0700
commit47549aa3d10808c063d45dcaa598887dadde59c5 (patch)
tree4ae21bf95c9f3b4cce97a0a0473fe622fdb393eb /internal
parent643cbc4d6e37d07619bec05039da1abb411d28d4 (diff)
compat: Enable the cache benchmark
This should have been done back in 8aa12d3 (struct.go: Cache structIndexes, 2023-01-26)
Diffstat (limited to 'internal')
-rw-r--r--internal/jsonstruct/struct.go4
1 files changed, 4 insertions, 0 deletions
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 {