#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.
|
int | main (int argc, char **argv) |
|
◆ BUFSIZE
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 35 of file test_json_parser_perf.c.
50 if (strcmp(argv[1],
"-i") == 0)
56 sscanf(argv[1],
"%d", &iter);
58 if ((json_file = fopen(argv[2],
PG_BINARY_R)) == NULL)
59 pg_fatal(
"Could not open input file '%s': %m", argv[2]);
61 while ((n_read = fread(buff, 1, 6000, json_file)) > 0)
66 for (
int i = 0;
i < iter;
i++)
84 pg_fatal(
"unexpected result %d (expecting %d) on parse",
JsonParseErrorType pg_parse_json_incremental(JsonLexContext *lex, const JsonSemAction *sem, const char *json, size_t len, bool is_last)
JsonParseErrorType pg_parse_json(JsonLexContext *lex, const JsonSemAction *sem)
const JsonSemAction nullSemAction
JsonLexContext * makeJsonLexContextCstringLen(JsonLexContext *lex, const char *json, size_t len, int encoding, bool need_escapes)
void freeJsonLexContext(JsonLexContext *lex)
JsonLexContext * makeJsonLexContextIncremental(JsonLexContext *lex, int encoding, bool need_escapes)
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, exit(), 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.