zoukankan      html  css  js  c++  java
  • C++库研究笔记——Linux下是否需要使用memory pool?

    Linux Slab分配器(一)--概述

    Linux slab 分配器剖析

    做了一些测试:发现linux使用内存池与否没有明显差别,仅仅有2倍。 Linux内存处理机制已经很好,一般情况下,确实没有必要在用内存池??? 不知道大家持什么样的观点。




    速度测试:

    In [use pool]:0.00560116768 seconds
    In [ no pool]:0.00855708122 seconds


    In [use pool]:0.00404405594 seconds
    In [ no pool]:0.00921702385 seconds


    In [use pool]:0.0060069561 seconds
    In [ no pool]:0.0129909515 seconds


    In [use pool]:0.00984287262 seconds
    In [ no pool]:0.0179138184 seconds


    In [use pool]:0.00937509537 seconds
    In [ no pool]:0.0222010612 seconds


    In [use pool]:0.0128059387 seconds
    In [ no pool]:0.0269629955 seconds


    In [use pool]:0.0170590878 seconds
    In [ no pool]:0.0312800407 seconds


    In [use pool]:0.0199379921 seconds
    In [ no pool]:0.0355689526 seconds


    In [use pool]:0.0220119953 seconds
    In [ no pool]:0.0396490097 seconds


    In [use pool]:0.0250389576 seconds
    In [ no pool]:0.0438430309 seconds


    02:36:16:~/../pool_test$ vim MainFile.cpp 


    g++ MemPool.o TestClass.o MainFile.cpp -o main -O3


    Press ENTER or type command to continue
    02:37:21:~/../pool_test$ ./main 
    In [use pool]:0.000194072723 seconds
    In [ no pool]:0.000468015671 seconds


    In [use pool]:0.000373125076 seconds
    In [ no pool]:0.000900030136 seconds


    In [use pool]:0.000594139099 seconds
    In [ no pool]:0.00134897232 seconds


    In [use pool]:0.000751018524 seconds
    In [ no pool]:0.00190091133 seconds


    In [use pool]:0.000940084457 seconds
    In [ no pool]:0.0022559166 seconds


    In [use pool]:0.00139307976 seconds
    In [ no pool]:0.00420188904 seconds


    In [use pool]:0.00148892403 seconds
    In [ no pool]:0.00316882133 seconds


    In [use pool]:0.00165891647 seconds
    In [ no pool]:0.00361800194 seconds


    In [use pool]:0.00178599358 seconds
    In [ no pool]:0.00484013557 seconds


    In [use pool]:0.0184268951 seconds
    In [ no pool]:0.0416920185 seconds


    In [use pool]:0.0186669827 seconds
    In [ no pool]:0.043035984 seconds


    In [use pool]:0.0192191601 seconds
    In [ no pool]:0.0422170162 seconds


    In [use pool]:0.0193469524 seconds
    In [ no pool]:0.0423469543 seconds


    In [use pool]:0.0193350315 seconds
    In [ no pool]:0.0422008038 seconds


    In [use pool]:0.0196199417 seconds
    In [ no pool]:0.0431320667 seconds


    In [use pool]:0.0197191238 seconds
    In [ no pool]:0.0441551208 seconds


    In [use pool]:0.0201468468 seconds
    In [ no pool]:0.0435791016 seconds



  • 相关阅读:
    Leetcode 449. Serialize and Deserialize BST
    机器学习入门(1)------python基础
    Leetcode 23. Merge k Sorted Lists
    mysql explain执行计划详解
    ubuntu下安装chrome浏览器证书
    ubantu下配置android开发环境(Ubuntu 12.04.4 LTS x64 dell 3420)
    system v信号量的深入剖析
    AI文件格式解析
    STC12LE5A60S2第二串口出现的奇葩问题
    ZIGBEE官方协议栈 SampleApp工程DemoEB项目 运行机制详解
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3347981.html
Copyright © 2011-2022 走看看