Simple benchmarks and performance improvements

- added some simple benchmarks
- basic perf improvements (low hanging fruits, see individual commits)
- fixed a bug with realloc on empty buffer

@kkaefer