-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class의 성능을 향상 시킬수 있는 방법들을 나열해보시오. #2
Comments
스위프트 코드에서 성능에 영향을 주는 요소
클래스의 특징클래스는 기본적으로 heap allocation을 사용하고, 이로 인해 reference counting이 발생한다. 또한 dynamic dispatch로 메소드를 호출한다. <요소별 성능 향상 방법>Allocation
Reference Counting
Method Dispatch
📝 참고 |
Dispatch메서드를 호출할 때, 어떤 메서드(or 프로퍼티)를 호출할지 결정하는 메커니즘
class에서 Static Dispatch 가 실행되도록 하는 방법
|
Method Dispatch어떤 메서드( Static Dispatch
Dynamic Dispatch
class의 성능을 향상 시킬수 있는 방법
📝 참고 사이트 |
1. Static Dispatch 사용class뿐만 아니라 상속, 오버라이딩 될 필요가 없는 클래스, 메서드, 프로퍼티에 final 키워드를 붙여 Static Dispatch를 통해 성능 향상을 기대할 수 있다. Static Dispatch?
dynamic Dispatch?
2. 파일내에서만 접근해도 될 경우에는 private 키워드를 붙인다.
3. Whole Module Optimization(WMO)를 사용WMO는 컴파일러의 최적화 모드이며 컴파일러 플래그를 이용하여 켤 수 있다.
📝참조 |
No description provided.
The text was updated successfully, but these errors were encountered: