From ab1a061756bb6fc2e0f98cb57852f2bb0c6f9772 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 30 Sep 2024 15:21:02 +0200 Subject: [PATCH] avoid threadvar for field table (#98) * avoid threadvar for field table * bump --- json_serialization/reader_impl.nim | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/json_serialization/reader_impl.nim b/json_serialization/reader_impl.nim index 13563ec..b4cd801 100644 --- a/json_serialization/reader_impl.nim +++ b/json_serialization/reader_impl.nim @@ -189,10 +189,8 @@ proc readRecordValue*[T](r: var JsonReader, value: var T) const someCode = T.totalSerializedFields > 0 when someCode: - let - fieldsTable = T.fieldReadersTable(ReaderType) - const + fieldsTable = T.fieldReadersTable(ReaderType) expectedFields = T.expectedFieldsBitmask var @@ -207,13 +205,13 @@ proc readRecordValue*[T](r: var JsonReader, value: var T) mostLikelyNextField += 1 discard key else: - let fieldIdx = findFieldIdx(fieldsTable[], + let fieldIdx = findFieldIdx(fieldsTable, key, mostLikelyNextField) do: when someCode: if fieldIdx != -1: - let reader = fieldsTable[][fieldIdx].reader + let reader = fieldsTable[fieldIdx].reader reader(value, r) encounteredFields.setBitInArray(fieldIdx) elif r.allowUnknownFields: