zoukankan      html  css  js  c++  java
  • 读书笔记之:Efficient C++ 提高C++性能的编程技术(2003)[++]

    第1章 跟踪范例

    第2章 构造函数和析构函数

    第3章 虚函数

    1. 虚函数造成的性能损失

    第4章 返回值优化

    任何时候只要跳过了对象的创建和清除,就将会获得性能上的收益。返回值优化RVO(Return Value Optimization)是由编译器实现的优化,它用于加速源代码,是通过对源代码进行转化并消除对象的创建来实现的。

    1. 按值返回的构造

    下面是Complex类:

    class Complex{
        friend Complex operator+(const Complex &,const Complex&);
        public:
        Complex(double r=0.0,double i=0.0):real(r),imag(i){}
        Complex(const Complex& c):real(c.real),imag(c.imag){}
        Complex& operator=(const Complex& c){
            if(this!=&c){
                real=c.real;
                imag=c.imag;
            }
            return *this;
        }
        ~Complex(){}
        private:
        double real;
        double imag;
    };
    Complex operator+(const Complex&a,const Complex& b){
        Complex ret;
        ret.real=a.real+b.real;
        ret.imag=a.imag+b.imag;
        return ret;
    }                                                         

    2. 返回值优化

    3. 计算性构造函数

    第5章 临时对象

    1. 对象的定义

    2. 类型不同时的类型转换

    3. 按值传递

    第6章 单线程内存池

    第8章 内联基础

    1. 方法调用的代价

    引用计数

  • 相关阅读:
    app测试点
    【Android自动化打包】03. APK的数字签名
    【转】测试架构师团队的管理
    【转】用户体验质量的测试方法论-“你的风扇方案”
    【转】大数据本质与测试
    jquery 获取下拉框值与select text
    js获取下拉,单选
    jquery插件
    加密
    plsql 只能识别32位的oracle解决办法
  • 原文地址:https://www.cnblogs.com/xkfz007/p/2646795.html
Copyright © 2011-2022 走看看