dynamic buffer class, perf optimizations