avoid threadvar for field table (#98)
* avoid threadvar for field table * bump
This commit is contained in:
parent
b83739b430
commit
ab1a061756
|
@ -189,10 +189,8 @@ proc readRecordValue*[T](r: var JsonReader, value: var T)
|
||||||
const someCode = T.totalSerializedFields > 0
|
const someCode = T.totalSerializedFields > 0
|
||||||
|
|
||||||
when someCode:
|
when someCode:
|
||||||
let
|
|
||||||
fieldsTable = T.fieldReadersTable(ReaderType)
|
|
||||||
|
|
||||||
const
|
const
|
||||||
|
fieldsTable = T.fieldReadersTable(ReaderType)
|
||||||
expectedFields = T.expectedFieldsBitmask
|
expectedFields = T.expectedFieldsBitmask
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -207,13 +205,13 @@ proc readRecordValue*[T](r: var JsonReader, value: var T)
|
||||||
mostLikelyNextField += 1
|
mostLikelyNextField += 1
|
||||||
discard key
|
discard key
|
||||||
else:
|
else:
|
||||||
let fieldIdx = findFieldIdx(fieldsTable[],
|
let fieldIdx = findFieldIdx(fieldsTable,
|
||||||
key,
|
key,
|
||||||
mostLikelyNextField)
|
mostLikelyNextField)
|
||||||
do:
|
do:
|
||||||
when someCode:
|
when someCode:
|
||||||
if fieldIdx != -1:
|
if fieldIdx != -1:
|
||||||
let reader = fieldsTable[][fieldIdx].reader
|
let reader = fieldsTable[fieldIdx].reader
|
||||||
reader(value, r)
|
reader(value, r)
|
||||||
encounteredFields.setBitInArray(fieldIdx)
|
encounteredFields.setBitInArray(fieldIdx)
|
||||||
elif r.allowUnknownFields:
|
elif r.allowUnknownFields:
|
||||||
|
|
Loading…
Reference in New Issue