• <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ù). .
            欧美日韩精品久久久免费观看| 精品久久久久久国产潘金莲| 久久综合九色综合久99| 久久免费精品一区二区| 青春久久| 国产精品美女久久久久久2018| 久久九九亚洲精品| 久久亚洲日韩看片无码| 日本久久久久久中文字幕| 久久亚洲精品无码VA大香大香| 97久久精品午夜一区二区| 亚洲精品乱码久久久久久不卡| 久久婷婷成人综合色综合| 一本大道久久东京热无码AV| 久久精品国产亚洲AV电影| 久久久久久久久66精品片| 成人精品一区二区久久| a级成人毛片久久| 亚洲综合伊人久久大杳蕉| 激情综合色综合久久综合| 99久久精品国产免看国产一区| 久久国产免费直播| 亚洲国产天堂久久综合| 国产免费久久久久久无码| 久久精品国产亚洲AV大全| 天天爽天天狠久久久综合麻豆| 午夜视频久久久久一区| 7国产欧美日韩综合天堂中文久久久久 | 久久超碰97人人做人人爱| 亚洲国产成人久久一区WWW| 狠狠色丁香婷婷久久综合不卡| 日韩精品久久无码中文字幕| 中文字幕无码av激情不卡久久| 精品久久久久久国产三级| 成人国内精品久久久久影院VR| 一级做a爱片久久毛片| 亚洲乱亚洲乱淫久久| 老司机国内精品久久久久| 91精品国产91久久| 久久天天躁狠狠躁夜夜2020老熟妇 | 精品国产99久久久久久麻豆|