bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.54k stars 328 forks source link

Performance issues with Defaultr #1178

Open dwieland opened 1 year ago

dwieland commented 1 year ago

Hey, I'm trying to transform a lot of small sized JSON objects with Jolt and noticed that Shiftr and Defaultr have a huge gap in runtime performance. Shiftr is doing really great while Defaultr is magnitudes slower. I've profiled my use case a bit and found the bottleneck to be DeepCopy.simpleDeepCopy( literalValue ). The deep copy uses Java Serialization with InputStream and OutputStream and makes up for over 80% of the total Defaultr runtime. I'm not quite sure why a spec like this needs any deep copying:


{
  "operation": "default",
  "spec": {
    "deviceIdType": "name"
  }
}
dwieland commented 1 year ago

I've tracked it back to this 9 year old change: https://github.com/bazaarvoice/jolt/commit/6018bba8ab98edb8836acfb41df2fb2efa17a443

Running the test case without the deep-copy changes made there still shows the same result.