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

Reduce allocations in BinaryPropertyListParser #38

Closed qmfrederik closed 6 years ago

qmfrederik commented 6 years ago

Remove a couple of string allocations to make the parsing of binary property lists a bit faster.

Results in a 5% performance increase on Linux and a 1% performance increase on Windows.

claunia commented 6 years ago

@qmfrederik tell me when you're finished with PRs and I'll release a nupkg so we can remove the non-Span methods.

qmfrederik commented 6 years ago

Windows

Before

Method Mean Error StdDev Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 1.200 ms 0.0203 ms 0.0190 ms 117.1875 54.6875 720.21 KB

After

Method Mean Error StdDev Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 1.190 ms 0.0174 ms 0.0162 ms 115.2344 52.7344 719.85 KB

Linux

Before

Method Mean Error StdDev Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 1.831 ms 0.0351 ms 0.0328 ms 113.2813 56.6406 720.21 KB

After

Method Mean Error StdDev Gen 0 Gen 1 Allocated
ReadLargePropertylistTest 1.758 ms 0.0328 ms 0.0274 ms 113.2813 56.6406 719.85 KB
qmfrederik commented 6 years ago

@claunia OK, so I rebased the last PR and it looks ready to go.

I think there's enough of improvements to warrant a new NuGet release 😄

claunia commented 6 years ago

Ok I'll try to do it during the week.