Buffer optimization