Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Session of low-level optimization of memory usage in C++ programs with total exposure

, , 22 Jun 2009
In this article, we will try to make our algorithms work faster using the methods of low-level optimization of memory allocation in C++.
make-it-faster.zip
src
make_it_faster
make_it_faster_80.vcproj.DEV.ligen.user
alloc
win32
make_it_faster_win32
make_it_faster_win32_80.vcproj.DEV.ligen.user
win32_arena_local_sample
arena_local_sample_80.vcproj.DEV.ligen.user
win32_arena_sample
arena_sample_80.vcproj.DEV.ligen.user
win32_arena_tests
arena_tests_80.vcproj.DEV.ligen.user
win32_fast_object_sample
fast_object_sample_80.vcproj.DEV.ligen.user
#ifndef CMN_ARENA_STL_ALLOCATORS_H
#define CMN_ARENA_STL_ALLOCATORS_H

#include "cmnArenaAllocators.h"
#include "map"
#include "list"
#include "vector"
#include "set"

namespace utils
{

template<class KeyType, class ValueType>
struct arena_map
{
    typedef  std::map<KeyType,
                      ValueType,
                      std::less<KeyType>,
                      utils::factory<
                                    utils::arena_allocator,    // allocator type
                                    utils::without_params      // this type cannot use params
                                >
                                ::result
                                <
                                    std::pair<
                                                const KeyType,
                                                ValueType
                                            >
                                >
    > result;
};

template<class KeyType>
struct arena_set
{
    typedef  std::set<KeyType,
                      std::less<KeyType>,
                      utils::factory<
                                    utils::arena_allocator,    // allocator type
                                    utils::without_params      // this type cannot use params
                                >
                                ::result
                                <
                                    const KeyType
                                >
    > result;
};

template<class ValueType>
struct arena_list
{
    typedef  std::list<ValueType,
                      utils::factory<
                                    utils::arena_allocator,    // allocator type
                                    utils::without_params      // this type cannot use params
                                >
                                ::result
                                <
                                    ValueType
                                >
    > result;
};

template<class ValueType>
struct arena_vector
{
    typedef  std::vector<ValueType,
                      utils::factory<
                                    utils::arena_allocator,    // allocator type
                                    utils::without_params      // this type cannot use params
                                >
                                ::result
                                <
                                    ValueType
                                >
    > result;
};



} // utils

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Authors

No Biography provided

Apriorit Inc
Apriorit Inc.
Ukraine Ukraine
ApriorIT is a Software Research and Development company that works in advanced knowledge-intensive scopes.
 
Company offers integrated research&development services for the software projects in such directions as Corporate Security, Remote Control, Mobile Development, Embedded Systems, Virtualization, Drivers and others.
 
Official site http://www.apriorit.com
Group type: Organisation

31 members

Follow on   LinkedIn

| Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 23 Jun 2009
Article Copyright 2009 by Victor A. Milokum, Apriorit Inc
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid