Commit Graph
17 Commits
Author SHA1 Message Date
Perry Kundert a8cc7a1bc8 Consistently use std::char_traits int_type-->char conversion intrinsics 2017-10-16 08:06:10 -07:00
Perry Kundert 0b803d0a5f Simplify the json/src/benchmarks.cpp to allow more optimal code gen.
o For some unknown reason, the complexity of the benchmark platform
  prevented some C++ compilers from generating optimal code, properly
  reflective of the real performance in actual deployment.
o Added the json_benchmarks_simple target, which performs the same
  suite of tests as json_benchmarks.
o Simplified the benchmark platform, and emit an "Average" TPS
  (Transactions Per Second) value reflective of aggregate parse/output
  performance.
2017-10-07 15:50:19 -07:00
Perry Kundert 23440eb86e Remove outdated commentary about the value of eof(), retain input type
o We assume the same character int_type as the unerlying std::istream
o There are no assumptions on the value of eof(), other than that it
  will not be a valid unsigned char value.
o To retain performance, we do not allow swapping out the underlying
  std::streambuf during our use of the std::istream for parsing.
2017-10-06 12:54:43 -07:00
Perry Kundert 45e1e3d48a Revert some unnecessary member initializer changes. 2017-10-06 07:53:31 -07:00
Perry Kundert 5e480b56d8 Further simplify character type handling 2017-10-06 07:37:49 -07:00
Perry Kundert 1b43a45bec Implement correct handling of std::streambuf int_type, eof()
o Make no assumptions about eof(), other than that it is somewhere
  outside of the valid range of char_type.
2017-10-05 16:16:41 -07:00
Perry Kundert 184dab60e6 Accelerate access to underlying std::istream streambuf 2017-10-05 16:16:41 -07:00
Perry Kundert f775922ca8 Specify initializers for yytest, token_string using initializer-lists
o We can retain -Weffc++ and specify default initializers by using
  initializer lists.  The risks are low (of additional non-conformat
  compilers), because there is already one other such initialization
  used in the code-base.
2017-10-05 16:16:41 -07:00
Perry Kundert 546e148b24 Further performance improvements, and corrections in get_token_string
o An (-'ve valued, typically -1) EOF must never be allowed in
  token_string, as it be converted to 255 -- a legitimate value.
o Comparing against a specific eof() (-1, typically) is more costly than
  detecting +'ve/-'ve.  Since EOF is the only non-positive value allowed
  we can use the simpler test.
o Removed unnecessary test for token_string size, as it is already
  tested in the method, and must never occur in correct code; used an
  assert instead.
2017-10-05 16:16:41 -07:00
Perry Kundert 8665e25942 Rename get_string to move_string to imply side-effect 2017-10-05 16:16:41 -07:00
Perry Kundert e0d890cc23 Corrected unnnecessary const restriction on returned std::string 2017-10-05 16:16:41 -07:00
Perry Kundert 97a388802d Improve performance by constructing yytext as a std::string
o Return its contents when necessary.  In many cases, this avoids
  construction of multiple copies of the yytext token.  Exceeds
  performance of current develop branch.
2017-10-05 16:15:46 -07:00
Perry Kundert 7c523338c5 Remove unnnecessary NUL termination of yytext (as it may contain NULs) 2017-10-05 16:01:41 -07:00
Perry Kundert 14ca1f6f09 Restore istream performance #764
o Use std::streambuf I/O instead of std::istream; does not maintain
  (unused) istream flags.
o Further simplify get/unget handling.
o Restore original handling of NUL in input stream; ignored during
  token_string escaping.
2017-10-05 16:01:41 -07:00
Perry Kundert 12efeadc2e Further simplify istream handling; use native unget 2017-10-05 16:01:41 -07:00
Perry Kundert f585fe4eec Test to confirm parsing of multiple JSON records in a istream #367 2017-10-05 16:01:41 -07:00
Perry Kundert 90adf6ec20 Simplify get_token_string, unnecessary buffering, handle Byte Order Mark 2017-10-05 16:01:41 -07:00