• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 311, comments - 0, trackbacks - 0, articles - 0
              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
            #include "stdafx.h"
            #include 
            <iostream>
            #include 
            <vector>
            #include 
            <time.h>
            #include 
            <boost/pool/pool_alloc.hpp>
            template
            <typename T>
            class alloc 
            {
            public:
                typedef std::size_t     size_type;
                typedef std::ptrdiff_t  difference_type;
                typedef T
            *    pointer;
                typedef 
            const T* const_pointer;
                typedef T
            &    reference;
                typedef 
            const T& const_reference;
                typedef T     value_type;
            public:
                     alloc(){}
                 template
            <typename T>
                 alloc(
            const alloc<T>& ){
                 }
                 alloc
            & operator=(const alloc& rhs){
                     
            return *this;
                 }
                 
            static pointer allocate(size_type n)
                 {
                     
            return (pointer)malloc(n*sizeof(T));
                 }
                
            static void deallocate(pointer ptr, size_type n)
                {
                    free((pointer)ptr);
                }
                size_type max_size() 
            const throw() 
                { 
                    
            return size_t(-1/ sizeof(T);
                }
                template 
            <typename U>
                
            struct rebind
                { 
                    typedef alloc
            <U> other;
                };
                
            };
            int _tmain(int argc, _TCHAR* argv[])
            {      
                
                
            int start4 = GetTickCount();
                std::vector
            <int, alloc<int>> RR4;
                
            for (int i = 0; i < 10000000; i++)
                {
                    RR4.push_back(i);
                    
                }
                
            int time4 = GetTickCount()- start4;
                std::cout
            <<"alloc: "<<time4<<std::endl;
                
            int start3 = GetTickCount();
                std::vector
            <int, boost::fast_pool_allocator<int>> RR3;
                
            for (int i = 0; i < 10000000; i++)
                {
                    RR3.push_back(i);
                }
                
            int time3 = GetTickCount()- start3;
                std::cout
            <<"boost::fast_pool_allocator: "<<time3<<std::endl;
                
            int start1 = GetTickCount();
                std::vector
            <int,std::allocator<int>> RR1;
                
            for (int i = 0; i < 10000000; i++)
                {
                    RR1.push_back(i);
                }
                
            int time1 = GetTickCount()- start1;
                std::cout
            <<"std::allocator: "<<time1<<std::endl;

                
            int start2 = GetTickCount();
                std::vector
            <int, boost::pool_allocator<int>> RR2;
                
            for (int i = 0; i < 10000000; i++)
                {
                    RR2.push_back(i);
                }
                
            int time2 = GetTickCount()- start2;
                std::cout
            <<"boost::pool_allocator: "<<time2<<std::endl;
                
            return 0;
            }

            debug (VC2008):

            1. alloc: 11438
            2. boost::fast_pool_allocator: 19437
            3. std::allocator: 11562
            4. boost::pool_allocator: 27703
            5. 請(qǐng)按任意鍵繼續(xù). . .

             

            Release(VC2008):

            1. alloc: 375
            2. boost::fast_pool_allocator: 1032
            3. std::allocator: 343
            4. boost::pool_allocator: 1266
            5. 請(qǐng)按任意鍵繼續(xù). .
            久久精品亚洲中文字幕无码麻豆| 亚洲精品无码久久久久去q| av国内精品久久久久影院| 久久99精品国产99久久6男男| 国产精品久久久久久一区二区三区| 久久久久亚洲AV无码网站| 一本一道久久精品综合| 天天影视色香欲综合久久| 亚洲精品乱码久久久久久蜜桃不卡 | 久久se精品一区二区| 久久久久亚洲AV无码专区桃色| 一本一本久久A久久综合精品| 久久久噜噜噜www成人网| 久久久久久A亚洲欧洲AV冫| 日韩乱码人妻无码中文字幕久久| 99久久国产综合精品网成人影院| 久久久久亚洲AV成人网人人网站 | 色综合久久天天综线观看| 久久久噜噜噜www成人网| 无码人妻少妇久久中文字幕| 色综合合久久天天综合绕视看 | 久久婷婷色香五月综合激情 | 狠狠人妻久久久久久综合蜜桃| 久久亚洲国产最新网站| 久久亚洲AV无码西西人体| 99久久成人国产精品免费| 日本强好片久久久久久AAA| 亚洲欧美一级久久精品| 国产亚洲成人久久| 99国产精品久久| 久久精品国产亚洲精品2020| 国产A三级久久精品| 亚洲欧美久久久久9999| 久久精品国产精品亚洲下载| 国产精品免费看久久久香蕉| 久久99久久99小草精品免视看| 久久ZYZ资源站无码中文动漫| 亚洲AV无码成人网站久久精品大| 亚洲AV日韩精品久久久久久久| 狠狠综合久久综合88亚洲| 久久精品国产亚洲AV香蕉|