[
https://issues.apache.org/jira/browse/THRIFT-5767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylwester Lachiewicz closed THRIFT-5767.
----------------------------------------
Fix Version/s: 0.21.0
Resolution: Fixed
Fixed by commit a9b146349 (PR #2946), "THRIFT-5767: use string builder to parse
strings with escaped quotes", released in 0.21.0. ParseQuotedStringBody now
accumulates chunks in a strings.Builder instead of concatenating the whole
string per escaped quote, so the cost is amortised linear rather than quadratic.
The ticket was left open when the fix landed. Closing it now.
> 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
> Priority: Major
> Labels: go
> Fix For: 0.21.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> The current implementation of ParseQuotedStringBody() 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)