optimization to avoid resizing