buffer: optimize slicing