Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save CognitiveDisson/f417a91d6e4109d16b0664b2a6e39e41 to your computer and use it in GitHub Desktop.

Select an option

Save CognitiveDisson/f417a91d6e4109d16b0664b2a6e39e41 to your computer and use it in GitHub Desktop.

Revisions

  1. CognitiveDisson revised this gist Apr 8, 2020. No changes.
  2. CognitiveDisson revised this gist Apr 8, 2020. No changes.
  3. CognitiveDisson revised this gist Apr 8, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions the effect of swift extensions on the size of the binary
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ final class SomeClass: SomeProtocol {
    init() {}

    // The size of the binary with the implementation inside the class - 20788
    // object size file - 20784

    // func someMethod0() { print("1") }
    // func someMethod1() { print("1") }
    @@ -33,6 +34,7 @@ final class SomeClass: SomeProtocol {
    extension SomeProtocol {

    // The size of the binary with the implementation inside the class - 20860
    // object file size - 21440

    // func someMethod0() { print("1") }
    // func someMethod1() { print("1") }
  4. CognitiveDisson created this gist Apr 8, 2020.
    60 changes: 60 additions & 0 deletions the effect of swift extensions on the size of the binary
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@

    protocol SomeProtocol {
    func someMethod0()
    func someMethod1()
    func someMethod2()
    func someMethod3()
    func someMethod4()
    func someMethod5()
    func someMethod6()
    func someMethod7()
    func someMethod8()
    func someMethod9()
    }

    final class SomeClass: SomeProtocol {

    init() {}

    // The size of the binary with the implementation inside the class - 20788

    // func someMethod0() { print("1") }
    // func someMethod1() { print("1") }
    // func someMethod2() { print("2") }
    // func someMethod3() { print("3") }
    // func someMethod4() { print("4") }
    // func someMethod5() { print("5") }
    // func someMethod6() { print("6") }
    // func someMethod7() { print("7") }
    // func someMethod8() { print("8") }
    // func someMethod9() { print("9") }
    }

    extension SomeProtocol {

    // The size of the binary with the implementation inside the class - 20860

    // func someMethod0() { print("1") }
    // func someMethod1() { print("1") }
    // func someMethod2() { print("2") }
    // func someMethod3() { print("3") }
    // func someMethod4() { print("4") }
    // func someMethod5() { print("5") }
    // func someMethod6() { print("6") }
    // func someMethod7() { print("7") }
    // func someMethod8() { print("8") }
    // func someMethod9() { print("9") }
    }

    let some = SomeClass()
    some.someMethod0()
    some.someMethod1()
    some.someMethod2()
    some.someMethod3()
    some.someMethod4()
    some.someMethod5()
    some.someMethod6()
    some.someMethod7()
    some.someMethod8()
    some.someMethod9()