for-loop performance