• <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. 請按任意鍵繼續. .
            久久久中文字幕| 国产亚洲成人久久| 伊人久久综合精品无码AV专区| 久久久久久久91精品免费观看| 亚洲午夜久久久影院| 99久久国产综合精品麻豆| 青青热久久综合网伊人| 中文字幕精品久久| www.久久热.com| 国产精品99久久久精品无码| 7777久久亚洲中文字幕| 中文字幕亚洲综合久久菠萝蜜| 国产精品久久国产精麻豆99网站| 久久精品一区二区三区中文字幕| 久久久亚洲裙底偷窥综合 | 久久久精品视频免费观看| 97精品国产97久久久久久免费| 久久国产精品99久久久久久老狼| 久久夜色精品国产亚洲av| 久久久久久免费一区二区三区 | 亚洲一区精品伊人久久伊人 | 久久中文字幕一区二区| 久久精品国产免费观看| 欧美粉嫩小泬久久久久久久| 热99re久久国超精品首页| 亚洲成色www久久网站夜月| 欧美麻豆久久久久久中文| 亚洲国产精品一区二区久久| 久久发布国产伦子伦精品| 成人久久免费网站| 久久精品国产亚洲AV香蕉| 精品水蜜桃久久久久久久| 99久久精品无码一区二区毛片| 色88久久久久高潮综合影院| 精品人妻伦九区久久AAA片69| 久久久久亚洲精品日久生情| 久久久无码精品亚洲日韩京东传媒| 性高湖久久久久久久久AAAAA | 国产精品九九久久免费视频 | 久久天天躁狠狠躁夜夜躁2O2O| 少妇人妻88久久中文字幕|