Closed rafaelnobrepd closed 6 years ago
@rafaelnobrepd Do you have a snippet of the JSON you are testing with? I'm curious to see if it is due to the size of the JSON in general, or perhaps just a product of how the JSON is structured. In particular I'm wondering if the JSON represents many instances of a particular JSON object in an array?
Once I have some further details I'll create some measurement tests and do some investigation.
Same issue here. My test case is a simple JSON with one field that contains around 2.5 MB of data. Deserialization - tested with breakpoint before and after
let jsonObject = try JSON(data: responseData!);
takes around 10 minutes.
Like all Swift code, Freddy is not designed for performance in debug mode. Compile the framework with optimizations on to get the best performance.
Large JSON responses ( > 1MB ) become extremely slow with 100% cpu for several minutes using the custom JSONParser in Swift 4. Instruments points to Array.append operations. Switching back to JSONSerialization improves the issue.