Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

6장 performance of game_최준혁_2

1,093 views

Published on

  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ..................................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookeBOOK Crime, eeBOOK Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

6장 performance of game_최준혁_2

  1. 1. 6~7장. 성능과 메모리<br />DreamexeWarrock Client Team : 최준혁<br />
  2. 2. overview<br />DreamexeWarrock Client Team : 최준혁<br />
  3. 3. 성능에 대한 고려<br />DreamexeWarrock Client Team : 최준혁<br />
  4. 4. 함수의 타입<br />DreamexeWarrock Client Team : 최준혁<br />
  5. 5. 전역 함수<br />intnHitPoints= GetHitPoints(gameUnit);// Example<br />DreamexeWarrock Client Team : 최준혁<br />
  6. 6. 클래스 정적 함수<br />intnumUnits= GameUnit::GetNumUnits();// Example<br />비 가상 멤버 함수<br />GameUnitgameUnit; // 인스턴스 생성<br />IntnHitPoints= gameUnit.GetHitPoints(); // 멤버 함수 호출<br />DreamexeWarrock Client Team : 최준혁<br />
  7. 7. 단일 상속에서의 가상 함수<br />GameUnit* pGameUnit= new SomeGameUnit;<br />// 부모 클래스 인스턴스에 자식 클래스 할당<br />pGameUnit -> RunAI();<br />// 가상 함수 호출<br />GameUnit<br />virtual void RunAI()<br />{<br /> // virtual function<br />}<br />SomeGameUnit<br />상속<br />void RunAI()<br />{<br />// Override code}<br />DreamexeWarrock Client Team : 최준혁<br />
  8. 8. 다중상속에서의 가상 함수<br />C<br />A<br />A<br />A<br />B<br />C<br />B<br />B<br />Vtable<br />Layout<br />C<br />DreamexeWarrock Client Team : 최준혁<br />
  9. 9. 인라인화<br />If ( gameUnit.IsActive() )<br />{ <br /> // …<br />}<br />Class GameUnit<br />{<br />inlineboolGameUnit::IsActive() const<br /> {<br /> return m_bActive;<br /> }<br />};<br />If ( gameUnit.m_bActive )<br />{ <br /> // …<br />}<br />DreamexeWarrock Client Team : 최준혁<br />
  10. 10. 부가적인 함수 오버헤드<br />DreamexeWarrock Client Team : 최준혁<br />
  11. 11. CPU가 빠를 수록, 메모리가 느릴수록 더 많은 사이클<br />대부분의 캐시는 32바이트, 개체의 크기를 32byte또는 그 배수로 맞추자<br />캐시와 메모리 정렬<br />512M * 6 = 3GHz 6 * 6 = 36CPU Cycle<br />3GHz<br />512Mhz<br />CPU<br />Chace<br />Memory<br />6<br />6<br />0xC0001F<br />0xC00020<br />(32)<br />0xC00024<br />Chace<br />~<br />(36)<br />(63)<br />0xC0003F<br />0xC00040<br />DreamexeWarrock Client Team : 최준혁<br />
  12. 12. 동적 할당 테스트<br />void main()<br />{<br /> char* p1 = new char[32];<br />printf("p1: %pn", p1);<br /> char* p2 = new char[32];<br />printf("p2 :%pn", p2);<br /> char* p3 = new char[32];<br />printf("p3 :%pn", p3);<br /> char* p4 = new char[32];<br />printf("p4 :%pn", p4);<br /> char* p5 = new char[32];<br />printf("p5 :%pn", p5);<br /> delete p2;<br /> delete p4;<br /> char* p6 = new char[32];<br />printf("p6 :%pn", p6);<br />}<br />여러 번 할당과 해제를 반복하면 메모리 단편화(임의 순으로 메모리 배정되기 때문)<br />DreamexeWarrock Client Team : 최준혁<br />
  13. 13. 메모리 관리자와 메모리풀<br />DreamexeWarrock Client Team : 최준혁<br />
  14. 14. 메모리풀#1<br />class MemoryPooler<br />{<br />public:<br /> virtual ~MemoryPooler() {}<br /> void* operator new(size_t size)<br />{ // new 연산자 오버로딩<br /> return s_pool.Alloc(size);<br />}<br /> void operator delete(void* obj, size_t size)<br />{ // delete 연산자 오버로딩<br />s_pool.Free(obj, size);<br />}<br />private:<br /> static MemoryPools_pool;<br />};<br />MemoryPoolMemoryPooler::s_pool;<br />MemoryPool<br />MemoryPooler<br />A<br />B<br />C<br />Main(테스트코드)<br />DreamexeWarrock Client Team : 최준혁<br />
  15. 15. 메모리풀#2<br />A<br />B<br />C<br />Main(테스트코드)<br />DreamexeWarrock Client Team : 최준혁<br />
  16. 16. 결론<br />메모리 풀 적극적 활용<br />클래스별로 메모리풀이 있는 것이 좋다.<br />(범용 풀도 클래스별로 나누어 주어야 한다.)<br />DreamexeWarrock Client Team : 최준혁<br />

×