|
Boost : |
From: christopher baus (christopher_at_[hidden])
Date: 2005-12-22 03:53:43
I've been playing around with ways to remove some of the hits to the
global allocator from asio/detail/reactor_op_queue.hpp, and decided to try
an alternative approach to pooling.
Instead of overriding STL allocators or global new/delete, I decided to
implement pooled lists in terms of lists themselves. I take advantage of
the fact that list::splice doesn't realloc nodes to move value data
between the active and free lists during insert and erase operations.
Chris's hash_map stores the value data in a std::list. I made that a
template parameter, which allowed me to optionally specify the
pooled_list.
The implementation is here:
http://baus.net/static/hash_map.hpp
http://baus.net/static/pooled_list.hpp
http://baus.net/static/pooled_hash_map.hpp
This doesn't address the bigger problem of the handler allocation, but
pre-allocing of the hash_map on *nix makes me a bit happier with the
implementation.
christopher
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk