Ray's playground

 

2012年3月12日

Item 24: Understand the costs of virtual functions, multiple inheritance, virtual base classes, and RTTI.

摘要: When a virtual function is called, the code executed must correspond to the dynamic type of the object on which the function is invoked; the type of the pointer or reference to the object is immaterial. How can compilers provide this behavior efficiently? Most implementations use virtual tables... 阅读全文

posted @ 2012-03-12 15:07 Ray Z 阅读(204) 评论(0) 推荐(0) 编辑

Item 23: Consider alternative libraries.(More Effective C++)

摘要: The contrast in performance between iostreams and stdio is just an example, however, it's not the main point. The main point is that different libraries offering similar functionality often feature different performance trade-offs, so once you've identified the bottlenecks in your software ( 阅读全文

posted @ 2012-03-12 14:35 Ray Z 阅读(226) 评论(0) 推荐(0) 编辑

Item 22: Consider using op= instead of stand-alone op.(More Effective C++)

摘要: All this talk of named objects, unnamed objects, and compiler optimizations is interesting, but let us not forget the big picture. The big picture is that assignment versions of operators (such as operator+=) tend to be more efficient than stand-alone versions of those operators (e.g. operator+... 阅读全文

posted @ 2012-03-12 14:23 Ray Z 阅读(245) 评论(0) 推荐(0) 编辑

导航