k walton created THRIFT-5767:
--------------------------------
Summary: Go Simple JSON Protocol re-allocates memory for every
escaped quote
Key: THRIFT-5767
URL: https://issues.apache.org/jira/browse/THRIFT-5767
Project: Thrift
Issue Type: Improvement
Components: Go - Library
Affects Versions: 0.19.0
Reporter: k walton
The current implementation of
[ParseQuotedStringBody()https://github.com/apache/thrift/blob/0e7236391f9ac7482f2e62a8c30155e015a80aa9/lib/go/thrift/simple_json_protocol.go#L953]
in the Go lib performs a memory allocation for every escaped quote in a string.
This is a particular problem for payloads with escaped JSON, which we ran into
causing performance issues in our application. Here is an example of the type
of payload I am referring to.
{code:java}
{ "example_value": "{ \"result\": [ { \"status\": \"active\",
\"name\": { \"first\": \"Olen\", \"middle\": \"London\",
\"last\": \"Willms\" }, \"username\": \"Olen-Willms\",
\"password\": \"yyBQPf4q2xy7G80\", \"emails\": [
\"[email protected]\", \"[email protected]\" ],
\"phoneNumber\": \"1-644-222-4224\", \"location\": { \"street\":
\"6475 Lenora Spurs\", \"city\": \"Alvenaborough\", \"state\":
\"Pennsylvania\", \"country\": \"San Marino\", \"zip\":
\"72274-2424\", \"coordinates\": { \"latitude\": -40.8732,
\"longitude\": 150.3412 } }, \"website\":
\"https://only-invention.org\", \"domain\": \"firsthand-dredger.info\",
\"job\": { \"title\": \"Legacy Communications Director\",
\"descriptor\": \"International\", \"area\": \"Directives\",
\"type\": \"Representative\", \"company\": \"Altenwerth - Pouros\"
}, \"creditCard\": { \"number\": \"3529-8485-1952-3730\",
\"cvv\": \"432\", \"issuer\": \"discover\" }, \"uuid\":
\"b3dc62ab-cef6-4b3a-ad26-390e69e15408\", \"objectId\":
\"65f4732a2d31b0f2a3c3beec\" } ]}"
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)