Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5767

Go Simple JSON Protocol re-allocates memory for every escaped quote

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.19.0
    • None
    • Go - Library

    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.

      {   "example_value": "{  \"result\": [    {      \"status\": \"active\",      \"name\": {        \"first\": \"Olen\",        \"middle\": \"London\",        \"last\": \"Willms\"      },      \"username\": \"Olen-Willms\",      \"password\": \"yyBQPf4q2xy7G80\",      \"emails\": [        \"Allene_Effertz@gmail.com\",        \"Carmen_Wuckert18@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\"    }  ]}" 
      }
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              k-walton k walton
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h