Created
April 3, 2024 07:50
-
-
Save irfanbaysal/5daa808051397a0022f3a3e17c1da4c1 to your computer and use it in GitHub Desktop.
Fundamentals for Creating Data Structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature | Struct | Class | Record (Limited Support) | |
---|---|---|---|---|
Type | Value Type | Reference Type | Reference Type | |
Mutability | Mutable | Mutable | Immutable (potentially in future) | |
Complexity | Simpler, for data grouping | Can be complex with inheritance and methods | More concise syntax for data-centric classes (limited use in Unity) | |
Memory Usage | Efficient for small data | Less efficient for frequently copied large structs | Potentially less efficient than structs for small data (Unity context) | |
Unity Focus | Preferred for performance-critical data | Less common | Not fully supported yet | |
Performance | Generally fastest for small data | Slowest | Potentially slower than structs, but with benefits (future) | |
Data Access | Direct access | Reference indirection (slower) | Reference indirection (slower) | |
Built-in Functionalities | No | No | Equality comparison, Hashing (potential benefit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment