claunia / plist-cil

C#/.NET parser for Apple and GnuStep Property List (aka plist), based on Java's dd-plist
Other
54 stars 17 forks source link

Refactor the UID class #43

Closed qmfrederik closed 6 years ago

qmfrederik commented 6 years ago

In the end, a UID object is an reference to another object, by id. The value of UID is always positive (because it is an index). The maximum allowed value is ulong.MaxValue.

UIDs have no (meaningful) names; they are just numbers.

With this in mind:

This helps, you have guessed it, performance, as it's easier to track a ulong than it is to track a byte[]:

qmfrederik commented 6 years ago

Windows

Before

Method Mean Error StdDev Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 2.543 ms 0.0336 ms 0.0315 ms 175.7813 85.9375 1.06 MB

After

Method Mean Error StdDev Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 1.844 ms 0.0235 ms 0.0220 ms 117.1875 54.6875 720.21 KB

Linux

Before

Method Mean Error StdDev Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 3.240 ms 0.1291 ms 0.3766 ms 171.8750 85.9375 1.06 MB

After

Method Mean Error StdDev Median Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 2.128 ms 0.0416 ms 0.0671 ms 2.096 ms 109.3750 54.6875 720.21 KB