Probably Dance

I can program and like games

Month: November, 2014

plalloc: A simple stateful allocator for node based containers

Allocators in C++ are awkward classes. Allocators are usually zero size to make the containers small, and they have no state because that used to be difficult to do in C++. But nowadays we don’t really care about the size of our containers (we care about the size of the content of the containers) and since C++11 we have support for stateful allocators.

The problem I’m trying to solve is that node based containers have bad cache behavior because they allocate all over the place. So I wrote a small allocator which gives out memory from a contiguous block. It speeds up std::map and std::unordered_map. It’s called plalloc because I think this is a pool allocator.

Code is below:

Read the rest of this entry »

Ideas for a Programming Language

I’ve been simmering ideas for a programming language for a while. I’ll probably get around to actually writing one in a year or so. But Jonathan Blow is writing a new language right now and there is some overlap between his ideas and my ideas, so I kinda feel compelled to write about mine.

Since he just had a talk about compile time function evaluation, that will be my first post. But that’s not actually the order in which I want to write about things, so I’ll do a Star Wars move and post part 3 before posting part 1 and 2.

But still this post is a summary of what I will write:

Read the rest of this entry »