mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
56c9aa5bbe
Annotate internal/gqlparser structs not to include Position when marshaled to JSON. This makes the JSON roundtrip succeed without allocating a ton of memory for JSON fields that will be subsequently pruned. Upstream PR: https://github.com/vektah/gqlparser/pull/364 $ time ./reproducer-pre-fix Now passing 1262568 bytes to builtinGraphQLParseSchema() to reproduce the issue in ast.InterfaceToValue() Alloc = 4159 MiB TotalAlloc = 5625 MiB Sys = 5584 MiB NumGC = 18 Alloc = 8312 MiB TotalAlloc = 11169 MiB Sys = 11125 MiB NumGC = 19 Alloc = 8312 MiB TotalAlloc = 11169 MiB Sys = 11125 MiB NumGC = 19 Alloc = 16615 MiB TotalAlloc = 22247 MiB Sys = 22209 MiB NumGC = 20 Alloc = 16615 MiB TotalAlloc = 22247 MiB Sys = 22209 MiB NumGC = 20 Alloc = 16615 MiB TotalAlloc = 22247 MiB Sys = 22209 MiB NumGC = 20 Alloc = 38765 MiB TotalAlloc = 44397 MiB Sys = 44377 MiB NumGC = 20 Alloc = 33223 MiB TotalAlloc = 44397 MiB Sys = 44377 MiB NumGC = 21 $ time ./reproducer-post-fix Now passing 1262568 bytes to builtinGraphQLParseSchema() to reproduce the issue in ast.InterfaceToValue() real 0m0.545s user 0m0.201s sys 0m0.028s Signed-off-by: Rob Myers <1243316+robmyersrobmyers@users.noreply.github.com>