Maximum flow for 1/2" copper water service line at 85 PSI (maximum residential service) at the absolute best is just under 6 gallons a minute (but in reality it is unlikely that you get that kind of flow due to restrictions and bends, and perhaps it is service with PEX that have 5 gallon/min max at pressure with no other restriction and short length of tubing).
That said, hot water tank is normally at default 140F, and street water temperature at let say 39F (normally are 43-45F).
Mixed water at 89.5F for shower would be 1:1 hot:cold water, therefore 40 gal tank would take at the very least (40 * 2/6) = 13.33 minutes for you to empty the tank even if you turn of the fuel/electric so that HW tank have zero recovery rate.
In reality I would suspect it would be (40 * 2/4) = 20 +/-3 minutes to drain your HW tank.