@@ -34,6 +34,8 @@ namespace old_impl {
3434 case nfx::ParseErrorCode::InvalidMsgType: return " Invalid MsgType" ;
3535 case nfx::ParseErrorCode::GarbledMessage: return " Garbled message" ;
3636 case nfx::ParseErrorCode::OverflowExhausted: return " Field table overflow exhausted" ;
37+ case nfx::ParseErrorCode::BodyLengthMismatch: return " BodyLength mismatch" ;
38+ case nfx::ParseErrorCode::FieldCountExceeded: return " Field count exceeded maximum" ;
3739 }
3840 return " Unknown error" ;
3941}
@@ -115,7 +117,7 @@ inline void do_not_optimize(T&& value) {
115117// Test data
116118// ============================================================================
117119
118- constexpr std::array<nfx::ParseErrorCode, 12 > ALL_PARSE_ERRORS = {
120+ constexpr std::array<nfx::ParseErrorCode, 15 > ALL_PARSE_ERRORS = {
119121 nfx::ParseErrorCode::None,
120122 nfx::ParseErrorCode::BufferTooShort,
121123 nfx::ParseErrorCode::InvalidBeginString,
@@ -127,7 +129,10 @@ constexpr std::array<nfx::ParseErrorCode, 12> ALL_PARSE_ERRORS = {
127129 nfx::ParseErrorCode::DuplicateTag,
128130 nfx::ParseErrorCode::UnterminatedField,
129131 nfx::ParseErrorCode::InvalidMsgType,
130- nfx::ParseErrorCode::GarbledMessage
132+ nfx::ParseErrorCode::GarbledMessage,
133+ nfx::ParseErrorCode::OverflowExhausted,
134+ nfx::ParseErrorCode::BodyLengthMismatch,
135+ nfx::ParseErrorCode::FieldCountExceeded
131136};
132137
133138constexpr std::array<nfx::SessionErrorCode, 9 > ALL_SESSION_ERRORS = {
@@ -193,7 +198,7 @@ int main() {
193198 // Benchmark 1: ParseError message()
194199 // ========================================================================
195200
196- std::cout << " --- ParseError (12 codes, " << ITERATIONS << " iterations) ---\n\n " ;
201+ std::cout << " --- ParseError (15 codes, " << ITERATIONS << " iterations) ---\n\n " ;
197202
198203 // Warmup
199204 for (int i = 0 ; i < WARMUP ; ++i) {
@@ -390,7 +395,7 @@ int main() {
390395 std::cout << " |------------------|--------------|--------------|-------------|\n " ;
391396 std::cout << " | Average | | | " << avg_improvement << " % |\n " ;
392397
393- std::cout << " \n Total switch cases eliminated: 50 (12 + 9 + 20 + 9)\n " ;
398+ std::cout << " \n Total switch cases eliminated: 53 (15 + 9 + 20 + 9)\n " ;
394399
395400 return 0 ;
396401}
0 commit comments