[ 
https://issues.apache.org/jira/browse/THRIFT-5767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

k walton updated THRIFT-5767:
-----------------------------
    Description: 
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\": [        
\"allene_effe...@gmail.com\",        \"carmen_wucker...@gmail.com\"      ],     
 \"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}

  was:
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\": [        
\"allene_effe...@gmail.com\",        \"carmen_wucker...@gmail.com\"      ],     
 \"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}


> 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
>
> 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\": [        
> \"allene_effe...@gmail.com\",        \"carmen_wucker...@gmail.com\"      ],   
>    \"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)

Reply via email to