I've been thinking for a while about implementing some form of request
local allocations in one of my vibe.d applications. It would use
std.experimental.allocator with a thread/fiber local static array as the
memory with malloc as a fallback allocator. My idea is that it would
work like a bump the pointer alloctor which would at the end of a
request deallocate the memory by resetting the pointer to the beginning
of the buffer. To me this sounds really efficient, at least in theory.
Especially since most data is request specific and will not be shared
between request. I do have a couple of questions:

  1. To begin with, does this sound like a good idea in the first place?

  2. Is it enough if the array is thread local or does it need to be fiber
    local as well?

  3. How would I best integrate this if I use the REST API generator? As
    far as I understand vibe.d doesn't have any support for middleware or
    before/after hooks, which would be an ideal place for the setup and tear
    down of the buffers automatically

/Jacob Carlborg