• <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++博客 :: 首頁 :: 新隨筆 :: 聯(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. 請按任意鍵繼續(xù). . .

             

            Release(VC2008):

            1. alloc: 375
            2. boost::fast_pool_allocator: 1032
            3. std::allocator: 343
            4. boost::pool_allocator: 1266
            5. 請按任意鍵繼續(xù). .
            欧美精品乱码99久久蜜桃| 亚洲人成网亚洲欧洲无码久久| 久久国产乱子伦免费精品| 久久精品黄AA片一区二区三区 | 91久久精一区二区三区大全| 久久超乳爆乳中文字幕| 久久美女人爽女人爽| 亚洲欧美国产日韩综合久久| 亚洲狠狠婷婷综合久久久久 | segui久久国产精品| 久久久久久久综合综合狠狠| 精品久久久久久中文字幕大豆网| 亚洲AV无码久久寂寞少妇| 国产毛片久久久久久国产毛片| 中文字幕亚洲综合久久菠萝蜜 | 久久国产V一级毛多内射| 久久笫一福利免费导航 | 久久伊人亚洲AV无码网站| 久久香蕉超碰97国产精品| 久久涩综合| 国产L精品国产亚洲区久久| 久久综合鬼色88久久精品综合自在自线噜噜| 久久精品国产亚洲AV无码偷窥| 久久丝袜精品中文字幕| 国产香蕉97碰碰久久人人| 69久久精品无码一区二区| 伊人久久精品无码二区麻豆| 国产精品欧美亚洲韩国日本久久| 久久棈精品久久久久久噜噜| 无码8090精品久久一区| 久久精品国产黑森林| 丁香久久婷婷国产午夜视频| 久久精品国产91久久综合麻豆自制| 超级碰碰碰碰97久久久久| 人妻无码久久精品| 久久亚洲AV无码西西人体| 国产成人综合久久精品尤物| 91久久精品无码一区二区毛片| 久久久久久a亚洲欧洲aⅴ| 日韩欧美亚洲综合久久影院d3| 精品久久久久香蕉网|