• Michael Stella's avatar
    Remove unnecessary string copy in JSON serialization · 6696e55c
    Michael Stella authored
    Summary:
    `asString()` returns a string by value, which means a copy of the string must be made.
    
    We don't actually need to do this at all:
    - We know that the dynamic contains a string, thanks to the switch statement
    - The function being called with the result, `escapeString`, only wants a StringPiece anyway.
    
    So this copy is a waste. And uses significant CPU in my application.
    
    Reviewed By: ispeters
    
    Differential Revision: D29812197
    
    fbshipit-source-id: 60df668f7501f78f4282717d6896cd891950b6f5
    6696e55c
json.cpp 30.3 KB