Use cache on barekey in ITomlSerializedObject<T>.Serialize
Merged
PR
4mo ago+695+695+012345678901234567890123456789-63-63-01234567890123456789
This PR improves generated serialization of barekey (A-Za-z0-9_-) in ITomlSerializedObject<T>.Serialize.
Changed:
- If key is barekey, the implementation changes from
Utf8TomlDocumentWriter.PushKeytoUtf8TomlDocumentWriter.PushBareKey, which skips some verification process. And when callingUtf8TomlDocumentWriter.PushBareKey, it uses a cached key (ImmutableArray<byte>) instead of aReadOnlySpan<byte>. - If table header key is barekey, the implementation changes from
Utf8TomlDocumentWriter.WriteTableHeadertoUtf8TomlDocumentWriter.WriteBareTableHeader, which skips some verification process.