{"id":334326,"date":"2022-06-10T15:00:50","date_gmt":"2022-06-10T15:00:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=334326"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=334326","title":{"rendered":"<span>Swift. Struct vs Class memory and performance comparison \u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Struct<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>\u041a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0434\u0438\u043b\u0435\u043c\u043c\u043e\u0439: \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0412\u0437\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0444\u0430\u0441\u0430\u0434. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0438\u043c. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0438 \u043a\u043b\u0430\u0441\u0441, \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430: \u043e\u0431\u0430 \u043c\u043e\u0433\u0443\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c?<\/p>\n<h2>\u0410 \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 Apple?<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 Apple <a href=\"https:\/\/developer.apple.com\/documentation\/swift\/choosing_between_structures_and_classes\" rel=\"noopener noreferrer nofollow\">Choosing Between Structures and Classes<\/a>, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044f \u043f\u0443\u043d\u043a\u0442\u0443 &#171;Use structures by default.&#187;, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 Objective-C \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<h2>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/h2>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<pre><code class=\"swift\">protocol ObjectForProperties { var queue: DispatchQueue { get } \/\/ reference type var bool: Bool { get } \/\/ value type }  final class ClassForProperty: ObjectForProperties { var queue: DispatchQueue = .main var bool: Bool = true }  struct StructForProperty: ObjectForProperties { var queue: DispatchQueue = .main var bool: Bool = true }  var classForProperty = ClassForProperty() \/\/ reference type var structForProperty = StructForProperty() \/\/ value type var array = [1] \/\/ value type with Copy-on-Write<\/code><\/pre>\n<p>\u0426\u0435\u043b\u0435\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b:<\/p>\n<pre><code class=\"swift\">\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 final class UseClassWithoutProtocols { var ref: ClassForProperty var value: StructForProperty var array: [Int]  init(ref: ClassForProperty, value: StructForProperty, array: [Int]) { self.ref = ref self.value = value self.array = array } }  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 final class UseClassWithProtocols { var ref: ObjectForProperties var value: ObjectForProperties var array: [Int]  init(ref: ObjectForProperties, value: ObjectForProperties, array: [Int]) { self.ref = ref self.value = value self.array = array } }  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 struct UseStructWithoutProtocols { var ref: ClassForProperty var value: StructForProperty var array: [Int] }  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 struct UseStructWithProtocols { var ref: ObjectForProperties var value: ObjectForProperties var array: [Int] }  let useClassWithoutProtocols = UseClassWithoutProtocols(   ref: classForProperty,   value: structForProperty,   array: array ) let useClassWithProtocols = UseClassWithProtocols(   ref: classForProperty,    value: structForProperty,    array: array ) var useStructWithoutProtocols = UseStructWithoutProtocols(   ref: classForProperty,    value: structForProperty,   array: array ) var useStructWithProtocols = UseStructWithProtocols(   ref: classForProperty,    value: structForProperty,   array: array )<\/code><\/pre>\n<h2>\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h2>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0423 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440. \u0414\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"https:\/\/medium.com\/@lucianoalmeida1\/understanding-swift-copy-on-write-mechanisms-52ac31d68f2f\" rel=\"noopener noreferrer nofollow\">Copy-on-Write<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0430\u0434\u0440\u0435\u0441 \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u041d\u043e Copy-on-Write \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442\u043e \u0435\u0441\u0442\u044c StructForProperty \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430):<\/p>\n<pre><code class=\"swift\">func address&lt;T>(of o: UnsafePointer&lt;T>) -> String { String(format: \"%p\", Int(bitPattern: o)) }  func address&lt;T: AnyObject>(of classInstance: T) -> String { String(format: \"%p\", unsafeBitCast(classInstance, to: Int.self)) }  \/\/ classForProperty addresses print(address(of: classForProperty)) \/\/ 0x6000020e9600 print(address(of: useClassWithoutProtocols.ref)) \/\/ 0x6000020e9600 print(address(of: useStructWithoutProtocols.ref)) \/\/ 0x6000020e9600  \/\/ structForProperty addresses print(address(of: &amp;structForProperty)) \/\/ 0x111a1bca8 print(address(of: &amp;useClassWithoutProtocols.value)) \/\/ 0x600002edb6d8 print(address(of: &amp;useStructWithoutProtocols.value)) \/\/ 0x111a1bcd8  \/\/ array addresses print(address(of: &amp;array)) \/\/ 0x600002edb2f0 print(address(of: &amp;useClassWithoutProtocols.array)) \/\/ 0x600002edb2f0 print(address(of: &amp;useStructWithoutProtocols.array)) \/\/ 0x600002edb2f0<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c: <\/p>\n<ul>\n<li>\n<p>\u0421\u0441\u044b\u043b\u043e\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 Copy-on-Write \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0417\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c<\/h2>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 Stack, \u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 Heap, \u0438 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 Stack. Stack \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. Heap \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443. \u0418\u0437 \u0447\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u0432 Stack \u043d\u0443\u0436\u043d\u043e \u0431\u0435\u0440\u0435\u0447\u044c. <a href=\"https:\/\/habr.com\/ru\/post\/592385\/\" rel=\"noopener noreferrer nofollow\">\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u043f\u0430\u043c\u044f\u0442\u044c.<\/a><\/p>\n<pre><code class=\"swift\">MemoryLayout.size(ofValue: useClassWithoutProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 8 class_getInstanceSize(UseClassWithoutProtocols.self) \/\/ \u041e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 48  MemoryLayout.size(ofValue: useClassWithProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 8 class_getInstanceSize(UseClassWithProtocols.self) \/\/ \u041e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 104  MemoryLayout.size(ofValue: useStructWithoutProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 32  MemoryLayout.size(ofValue: useStructWithProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 88<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0435\u0440\u0435\u0447\u044c \u043f\u0430\u043c\u044f\u0442\u044c Stack, \u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b. \u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440, \u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. \u041d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c, \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b <a href=\"https:\/\/en.wikipedia.org\/wiki\/SOLID\" rel=\"noopener noreferrer nofollow\">SOLID<\/a> \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e <a href=\"https:\/\/habr.com\/ru\/post\/486902\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a>. \u0422\u0430\u043a \u0436\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u0440\u0430\u0437\u043c\u0435\u0440 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u0435\u043d \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<h2>\u0412\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h2>\n<p>\u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043e\u043b\u044c\u0448\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c \u0438 \u0441\u0435\u0439\u0447\u0430\u0441. <\/p>\n<p>\u0417\u0430\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u043b\u0435\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445:<\/p>\n<pre><code class=\"swift\">func countTime(_ workItem: () -> Void) -> Double { let start = CFAbsoluteTimeGetCurrent() workItem() return CFAbsoluteTimeGetCurrent() - start }  \/\/ \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 countTime { let _ = useClassWithoutProtocols.ref.bool  }<\/code><\/pre>\n<p>\u042f \u043f\u0440\u043e\u0432\u0435\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0442\u0438\u043f\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useClassWithoutProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000009597<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000007105<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useClassWithProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000009501<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000008715<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useStructWithoutProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000008059<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000008597<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useStructWithProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000007011<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000007714<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c\u0438, \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"left\">Stack<\/p>\n<\/td>\n<td>\n<p align=\"left\">Heap<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u0438\u043d\u0446\u0438\u043f\u044b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useClassWithoutProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useClassWithProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useStructWithoutProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"center\">_<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useStructWithProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f Stack, \u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f Stack.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0430\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 Stack \u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b, \u0430 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u044f \u0431\u044b \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/670790\/\"> https:\/\/habr.com\/ru\/post\/670790\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>\u041a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 iOS \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0434\u0438\u043b\u0435\u043c\u043c\u043e\u0439: \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0412\u0437\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0444\u0430\u0441\u0430\u0434. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0438\u043c. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0438 \u043a\u043b\u0430\u0441\u0441, \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430: \u043e\u0431\u0430 \u043c\u043e\u0433\u0443\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c?<\/p>\n<h2>\u0410 \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 Apple?<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 Apple <a href=\"https:\/\/developer.apple.com\/documentation\/swift\/choosing_between_structures_and_classes\" rel=\"noopener noreferrer nofollow\">Choosing Between Structures and Classes<\/a>, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044f \u043f\u0443\u043d\u043a\u0442\u0443 &#171;Use structures by default.&#187;, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 Objective-C \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<h2>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/h2>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<pre><code class=\"swift\">protocol ObjectForProperties { var queue: DispatchQueue { get } \/\/ reference type var bool: Bool { get } \/\/ value type }  final class ClassForProperty: ObjectForProperties { var queue: DispatchQueue = .main var bool: Bool = true }  struct StructForProperty: ObjectForProperties { var queue: DispatchQueue = .main var bool: Bool = true }  var classForProperty = ClassForProperty() \/\/ reference type var structForProperty = StructForProperty() \/\/ value type var array = [1] \/\/ value type with Copy-on-Write<\/code><\/pre>\n<p>\u0426\u0435\u043b\u0435\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b:<\/p>\n<pre><code class=\"swift\">\/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 final class UseClassWithoutProtocols { var ref: ClassForProperty var value: StructForProperty var array: [Int]  init(ref: ClassForProperty, value: StructForProperty, array: [Int]) { self.ref = ref self.value = value self.array = array } }  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 final class UseClassWithProtocols { var ref: ObjectForProperties var value: ObjectForProperties var array: [Int]  init(ref: ObjectForProperties, value: ObjectForProperties, array: [Int]) { self.ref = ref self.value = value self.array = array } }  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 struct UseStructWithoutProtocols { var ref: ClassForProperty var value: StructForProperty var array: [Int] }  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 struct UseStructWithProtocols { var ref: ObjectForProperties var value: ObjectForProperties var array: [Int] }  let useClassWithoutProtocols = UseClassWithoutProtocols(   ref: classForProperty,   value: structForProperty,   array: array ) let useClassWithProtocols = UseClassWithProtocols(   ref: classForProperty,    value: structForProperty,    array: array ) var useStructWithoutProtocols = UseStructWithoutProtocols(   ref: classForProperty,    value: structForProperty,   array: array ) var useStructWithProtocols = UseStructWithProtocols(   ref: classForProperty,    value: structForProperty,   array: array )<\/code><\/pre>\n<h2>\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h2>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0423 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440. \u0414\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"https:\/\/medium.com\/@lucianoalmeida1\/understanding-swift-copy-on-write-mechanisms-52ac31d68f2f\" rel=\"noopener noreferrer nofollow\">Copy-on-Write<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0430\u0434\u0440\u0435\u0441 \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u041d\u043e Copy-on-Write \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442\u043e \u0435\u0441\u0442\u044c StructForProperty \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430):<\/p>\n<pre><code class=\"swift\">func address&lt;T>(of o: UnsafePointer&lt;T>) -> String { String(format: \"%p\", Int(bitPattern: o)) }  func address&lt;T: AnyObject>(of classInstance: T) -> String { String(format: \"%p\", unsafeBitCast(classInstance, to: Int.self)) }  \/\/ classForProperty addresses print(address(of: classForProperty)) \/\/ 0x6000020e9600 print(address(of: useClassWithoutProtocols.ref)) \/\/ 0x6000020e9600 print(address(of: useStructWithoutProtocols.ref)) \/\/ 0x6000020e9600  \/\/ structForProperty addresses print(address(of: &amp;structForProperty)) \/\/ 0x111a1bca8 print(address(of: &amp;useClassWithoutProtocols.value)) \/\/ 0x600002edb6d8 print(address(of: &amp;useStructWithoutProtocols.value)) \/\/ 0x111a1bcd8  \/\/ array addresses print(address(of: &amp;array)) \/\/ 0x600002edb2f0 print(address(of: &amp;useClassWithoutProtocols.array)) \/\/ 0x600002edb2f0 print(address(of: &amp;useStructWithoutProtocols.array)) \/\/ 0x600002edb2f0<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u044c: <\/p>\n<ul>\n<li>\n<p>\u0421\u0441\u044b\u043b\u043e\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 Copy-on-Write \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0417\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c<\/h2>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 Stack, \u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 Heap, \u0438 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 Stack. Stack \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. Heap \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443. \u0418\u0437 \u0447\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043f\u0430\u043c\u044f\u0442\u044c \u0432 Stack \u043d\u0443\u0436\u043d\u043e \u0431\u0435\u0440\u0435\u0447\u044c. <a href=\"https:\/\/habr.com\/ru\/post\/592385\/\" rel=\"noopener noreferrer nofollow\">\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e \u043f\u0430\u043c\u044f\u0442\u044c.<\/a><\/p>\n<pre><code class=\"swift\">MemoryLayout.size(ofValue: useClassWithoutProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 8 class_getInstanceSize(UseClassWithoutProtocols.self) \/\/ \u041e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 48  MemoryLayout.size(ofValue: useClassWithProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 8 class_getInstanceSize(UseClassWithProtocols.self) \/\/ \u041e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 104  MemoryLayout.size(ofValue: useStructWithoutProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 32  MemoryLayout.size(ofValue: useStructWithProtocols) \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 Stack 88<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0431\u0435\u0440\u0435\u0447\u044c \u043f\u0430\u043c\u044f\u0442\u044c Stack, \u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b. \u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440, \u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. \u041d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c, \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b <a href=\"https:\/\/en.wikipedia.org\/wiki\/SOLID\" rel=\"noopener noreferrer nofollow\">SOLID<\/a> \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e <a href=\"https:\/\/habr.com\/ru\/post\/486902\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a>. \u0422\u0430\u043a \u0436\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u0440\u0430\u0437\u043c\u0435\u0440 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u0435\u043d \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<h2>\u0412\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h2>\n<p>\u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043e\u043b\u044c\u0448\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c \u0438 \u0441\u0435\u0439\u0447\u0430\u0441. <\/p>\n<p>\u0417\u0430\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u043b\u0435\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445:<\/p>\n<pre><code class=\"swift\">func countTime(_ workItem: () -> Void) -> Double { let start = CFAbsoluteTimeGetCurrent() workItem() return CFAbsoluteTimeGetCurrent() - start }  \/\/ \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 countTime { let _ = useClassWithoutProtocols.ref.bool  }<\/code><\/pre>\n<p>\u042f \u043f\u0440\u043e\u0432\u0435\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0442\u0438\u043f\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useClassWithoutProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000009597<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000007105<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useClassWithProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000009501<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000008715<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useStructWithoutProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000008059<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000008597<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">useStructWithProtocols<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000007011<\/p>\n<\/td>\n<td>\n<p align=\"left\">0,000007714<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0432\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c\u0438, \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"left\">Stack<\/p>\n<\/td>\n<td>\n<p align=\"left\">Heap<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u0438\u043d\u0446\u0438\u043f\u044b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useClassWithoutProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useClassWithProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useStructWithoutProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"center\">_<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"209\" width=\"209\">\n<p align=\"left\">useStructWithProtocols<\/p>\n<\/td>\n<td data-colwidth=\"140\" width=\"140\">\n<p align=\"center\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 \u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f Stack, \u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f Stack.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0430\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 Stack \u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b, \u0430 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u044f \u0431\u044b \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/670790\/\"> https:\/\/habr.com\/ru\/post\/670790\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-334326","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334326"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334326\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}