Skip to content

Instantly share code, notes, and snippets.

View Lazin's full-sized avatar

Eugene Lazin Lazin

  • Redpanda Data
  • The Hague, Netherlands
  • X @Lazin
View GitHub Profile
@Lazin
Lazin / gist:9042096
Created February 16, 2014 23:21
stackfull coroutine-based cursors prototype for akumuli
#include <iostream>
#include <vector>
#include <boost/coroutine/all.hpp>
#include <boost/bind.hpp>
#include <memory>
struct Cursor;
typedef boost::coroutines::coroutine< void(Cursor*) > coro_t;
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <iterator>
#include <random>
#include <boost/timer.hpp>
using namespace std;
template<typename T>
struct serializer<
type_prop::not_a_pod,
ser_method::use_internal_serializer,
archive_type::binary,
direction::in,
std::list<T>
> {
template<typename Archive>
static Archive& apply(Archive& ar, std::list<T>& list) {
//! Loading for std::list
template <class Archive, class T, class A> inline
void load( Archive & ar, std::list<T, A> & list )
{
size_type size;
ar( make_size_tag( size ) );
list.resize( static_cast<size_t>( size ) );
for( auto & i : list )
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <boost/timer.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/heap/skew_heap.hpp>
#include <google/profiler.h>
using namespace std;
class RWLock {
pthread_rwlock_t rwlock_;
public:
RWLock()
: rwlock_ PTHREAD_RWLOCK_INITIALIZER
{
}
...
};
#include <iostream>
#include <vector>
#include <boost/pool/pool.hpp>
#include <boost/timer.hpp>
#include <jemalloc/jemalloc.h>
using namespace std;
const size_t COUNT = 1000000;
const size_t SMALL_OBJ_SIZE = sizeof(int);
___ Begin jemalloc statistics ___
Version: 3.5.1-0-g7709a64c59daf0b1f938be49472fcc499e1bd136
Assertions disabled
Run-time option settings:
opt.abort: false
opt.lg_chunk: 22
opt.dss: "secondary"
opt.narenas: 32
opt.lg_dirty_mult: 3
opt.stats_print: false
  1. General Background and Overview
void do_read()
{
auto self(shared_from_this());
socket_.async_read_some(boost::asio::buffer(data_, max_length),
[this, self](boost::system::error_code ec, std::size_t length)
{
if (!ec)
{
do_write(length);
}