detach/reattach speed optimization