#include "postgres_fe.h"
#include "common/jsonapi.h"
#include "common/logging.h"
#include "lib/stringinfo.h"
#include "mb/pg_wchar.h"
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
◆ BUFSIZE
◆ main()
Definition at line 35 of file test_json_parser_perf.c.
36{
43 int iter;
45
47
49
50 if (
strcmp(argv[1],
"-i") == 0)
51 {
53 argv++;
54 }
55
56 sscanf(argv[1],
"%d", &iter);
57
59 pg_fatal(
"Could not open input file '%s': %m", argv[2]);
60
62 {
64 }
66 for (
int i = 0;
i < iter;
i++)
67 {
69 {
73 true);
75 }
76 else
77 {
82 }
84 pg_fatal(
"unexpected result %d (expecting %d) on parse",
86 }
88}
JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex, const JsonSemAction *sem, const char *json, size_t len, bool is_last)
JsonLexContext * makeJsonLexContextIncremental(JsonLexContext *lex, int encoding, bool need_escapes)
JsonParseErrorType pg_parse_json(JsonLexContext *lex, const JsonSemAction *sem)
JsonLexContext * makeJsonLexContextCstringLen(JsonLexContext *lex, const char *json, size_t len, int encoding, bool need_escapes)
const JsonSemAction nullSemAction
void freeJsonLexContext(JsonLexContext *lex)
void pg_logging_init(const char *argv0)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void initStringInfo(StringInfo str)
References appendBinaryStringInfo(), BUFSIZE, StringInfoData::data, fb(), freeJsonLexContext(), i, initStringInfo(), JSON_SUCCESS, StringInfoData::len, makeJsonLexContextCstringLen(), makeJsonLexContextIncremental(), nullSemAction, PG_BINARY_R, pg_fatal, pg_logging_init(), pg_parse_json(), pg_parse_json_incremental(), and PG_UTF8.