Deserialization Optimization - TROStreamSerializer.ReadArray

RemObjects SDK for Delphi
Version: 8.3.93.1183

TROStreamSerializer.ReadArray essentially does the following (if the array item type is a TROComplexType descendant):

  1. Read the size of the array from stream
  2. Resize the array
  3. Read the array items from stream

In step 2, the array will instantiate all its items.
In step 3, all those freshly created instances will be freed and replaced by new instances read from stream.

Obviously the instance creation in step 2 is unnecessary.

We patched this code to avoid the instance creation in step 2.

Result of a test (deserialization of arrays with ~7000 items total):

  • Without optimization: 100% serialization execution time
  • With optimization: 78% serialization execution time

We would be glad to see a similar improvement in the original RemObjects SDK code base.

Thanks, logged as bugs://76478

bugs://76478 got closed with status fixed.