Welcome! Log In Create A New Profile

Advanced

[njs] Optimising JSON.parse() for large objects.

Dmitry Volyntsev
April 28, 2022 08:56PM
details: https://hg.nginx.org/njs/rev/4d71bdf8663d
branches:
changeset: 1846:4d71bdf8663d
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Thu Apr 28 17:49:59 2022 -0700
description:
Optimising JSON.parse() for large objects.

diffstat:

src/njs_json.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 280e866c2973 -r 4d71bdf8663d src/njs_json.c
--- a/src/njs_json.c Thu Apr 28 17:23:02 2022 -0700
+++ b/src/njs_json.c Thu Apr 28 17:49:59 2022 -0700
@@ -877,8 +877,14 @@ njs_json_push_parse_state(njs_vm_t *vm,


njs_inline njs_json_state_t *
-njs_json_pop_parse_state(njs_json_parse_t *parse)
+njs_json_pop_parse_state(njs_vm_t *vm, njs_json_parse_t *parse)
{
+ njs_json_state_t *state;
+
+ state = &parse->states[parse->depth - 1];
+ njs_array_destroy(vm, state->keys);
+ state->keys = NULL;
+
if (parse->depth > 1) {
parse->depth--;
return &parse->states[parse->depth - 1];
@@ -956,7 +962,7 @@ njs_json_parse_iterator(njs_vm_t *vm, nj
}

} else {
- state = njs_json_pop_parse_state(parse);
+ state = njs_json_pop_parse_state(vm, parse);
if (state == NULL) {
vm->retval = parse->retval;
return NJS_OK;
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[njs] Optimising JSON.parse() for large objects.

Dmitry Volyntsev 436 April 28, 2022 08:56PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 151
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready