Skip to content

Commit

Permalink
avoid threadvar for field table (#98)
Browse files Browse the repository at this point in the history
* avoid threadvar for field table

* bump
  • Loading branch information
arnetheduck authored Sep 30, 2024
1 parent b83739b commit ab1a061
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions json_serialization/reader_impl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit ab1a061

Please sign in to comment.