• <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++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理
            #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. 請按任意鍵繼續. . .

             

            Release(VC2008):

            1. alloc: 375
            2. boost::fast_pool_allocator: 1032
            3. std::allocator: 343
            4. boost::pool_allocator: 1266
            5. 請按任意鍵繼續. .
            久久综合九色欧美综合狠狠| 狠狠色婷婷久久一区二区三区| 久久精品国产精品亚洲| 亚洲国产小视频精品久久久三级| 亚洲欧美伊人久久综合一区二区| 青青草国产成人久久91网| 亚洲性久久久影院| 久久99国产精品一区二区| 99久久香蕉国产线看观香| 久久久久一区二区三区| 久久久久青草线蕉综合超碰| 国产日韩欧美久久| 国产精品一区二区久久 | 漂亮人妻被黑人久久精品| 欧美久久综合性欧美| 久久WWW免费人成一看片| 亚洲欧美成人久久综合中文网| 国产精品一久久香蕉国产线看观看| 久久免费视频1| 性高湖久久久久久久久AAAAA| 日本久久久精品中文字幕| 久久天堂AV综合合色蜜桃网| 成人久久免费网站| 国产精品中文久久久久久久| 亚洲国产香蕉人人爽成AV片久久| 久久成人精品| 久久久精品国产亚洲成人满18免费网站| 国产精品久久国产精麻豆99网站| 无码精品久久久久久人妻中字| 久久中文字幕人妻丝袜| 久久受www免费人成_看片中文| 亚洲AⅤ优女AV综合久久久| 日韩久久无码免费毛片软件| 久久激情五月丁香伊人| 久久人人超碰精品CAOPOREN| 久久久久这里只有精品| 久久国产成人精品国产成人亚洲| 欧美亚洲日本久久精品| 久久综合亚洲鲁鲁五月天| 色妞色综合久久夜夜| 久久久久成人精品无码中文字幕|