Shared: JSON Parse Perf

Improve the mechanics for JSON parsing by reusing
text buffers during the parse.

Change-Id: I7fb2cae31e6558a5a0c63fd02e1fc6fec4f9e4b3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7106
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Andrew Lindesay
2023-11-16 20:38:21 +00:00
parent 8a00ea4af6
commit 35c4600e21
9 changed files with 746 additions and 112 deletions
+6 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2017, Andrew Lindesay <[email protected]>
* Copyright 2017-2023, Andrew Lindesay <[email protected]>
* Copyright 2014, Augustin Cavalier (waddlesplash)
* Distributed under the terms of the MIT License.
*/
@@ -39,14 +39,12 @@ private:
JsonParseContext& jsonParseContext);
static bool ParseObject(JsonParseContext& jsonParseContext);
static bool ParseArray(JsonParseContext& jsonParseContext);
static bool ParseEscapeUnicodeSequence(
JsonParseContext& jsonParseContext,
BString& stringResult);
static bool ParseStringEscapeSequence(
JsonParseContext& jsonParseContext,
BString& stringResult);
static bool ParseEscapeUnicodeSequence(JsonParseContext& jsonParseContext);
static bool ParseStringEscapeSequence(JsonParseContext& jsonParseContext);
static bool ParseString(JsonParseContext& jsonParseContext,
json_event_type eventType);
static bool ParseExpectedVerbatimStringAndRaiseEvent(
JsonParseContext& jsonParseContext,
const char* expectedString,
@@ -59,7 +57,7 @@ private:
size_t expectedStringLength,
char leadingChar);
static bool IsValidNumber(BString& number);
static bool IsValidNumber(const char* value);
static bool ParseNumber(JsonParseContext& jsonParseContext);
};