[PR #43] [MERGED] Refactor the UID class #70

Open
opened 2026-01-30 21:27:00 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/claunia/plist-cil/pull/43
Author: @qmfrederik
Created: 6/19/2018
Status: Merged
Merged: 6/22/2018
Merged by: @claunia

Base: masterHead: fixes/uid


📝 Commits (3)

  • 5797a92 UID: Store the value as an ulong instead of a byte array.
  • 22fbc6a Fix serialization of UID values
  • 2b4fe65 Refactur UIDs

📊 Changes

5 files changed (+179 additions, -126 deletions)

View changed files

📝 plist-cil.test/UIDTests.cs (+14 -30)
📝 plist-cil/BinaryPropertyListParser.cs (+1 -1)
📝 plist-cil/BinaryPropertyListWriter.cs (+10 -0)
📝 plist-cil/UID.cs (+153 -95)
📝 plist-cil/plist-cil.csproj (+1 -0)

📄 Description

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:

  • UID object can store their value as an ulong instead of a byte[] array, preventing the allocation of an array
  • We can deprecate constructors which take signed values (such asint instead of uint)
  • We can remove the name property alltogether.

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

  • 27% performance increase on Windows
  • 34% performance increase on Linux

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/claunia/plist-cil/pull/43 **Author:** [@qmfrederik](https://github.com/qmfrederik) **Created:** 6/19/2018 **Status:** ✅ Merged **Merged:** 6/22/2018 **Merged by:** [@claunia](https://github.com/claunia) **Base:** `master` ← **Head:** `fixes/uid` --- ### 📝 Commits (3) - [`5797a92`](https://github.com/claunia/plist-cil/commit/5797a92d917653092924db7cbd16cc1d2d0409d9) UID: Store the value as an ulong instead of a byte array. - [`22fbc6a`](https://github.com/claunia/plist-cil/commit/22fbc6afa5e6ae26cfbd28e2826566d20100752e) Fix serialization of UID values - [`2b4fe65`](https://github.com/claunia/plist-cil/commit/2b4fe6595eaf6cdf23c2975c05e901e159321ed2) Refactur UIDs ### 📊 Changes **5 files changed** (+179 additions, -126 deletions) <details> <summary>View changed files</summary> 📝 `plist-cil.test/UIDTests.cs` (+14 -30) 📝 `plist-cil/BinaryPropertyListParser.cs` (+1 -1) 📝 `plist-cil/BinaryPropertyListWriter.cs` (+10 -0) 📝 `plist-cil/UID.cs` (+153 -95) 📝 `plist-cil/plist-cil.csproj` (+1 -0) </details> ### 📄 Description 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: - UID object can store their value as an `ulong` instead of a `byte[]` array, preventing the allocation of an array - We can deprecate constructors which take signed values (such as`int` instead of `uint`) - We can remove the `name` property alltogether. This helps, you have guessed it, performance, as it's easier to track a `ulong` than it is to track a `byte[]`: - 27% performance increase on Windows - 34% performance increase on Linux --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-30 21:27:00 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claunia/plist-cil#70