Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CognitiveDisson/f417a91d6e4109d16b0664b2a6e39e41 to your computer and use it in GitHub Desktop.
Save CognitiveDisson/f417a91d6e4109d16b0664b2a6e39e41 to your computer and use it in GitHub Desktop.
`swiftc -gdwarf-types -emit-object gist.swift`
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
// object size file - 20784
// 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
// object file size - 21440
// 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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment