C ++ Library Study Notes-does memory pool need to be used in Linux?

Source: Internet
Author: User

Linux Slab distributor (1) -- Overview

C ++ Library Study Notes-memory pool implementation

I did some tests: I found that there is no significant difference in the use of memory pools in linux, but there are only two times (this is easily overwritten by computing)

Linux memory processing mechanism is good. Generally, there is no need to use a memory pool ??? I don't know what you think.




Speed test:

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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.