If I do not have enough standard attack items, and on the other hand I have a lot of items related to nonstandard attacks (especially passive attacks when I enter a room), in some cases it is more efficient to go back and forth between rooms.
However, if the enemies have very powerful attacks or there are many of them, you need to be very careful with your remaining HP.
Still, it is not always best to attack the enemy directly. It all depends on the items.