Fastest wait until pin changes from LOW to HIGH

then yes the compiler likely will optimize away the while.

I find it doesn't, I use that construct all the time.