Since we say that IDs are faster and are preferred over XPaths, how different would the execution of the following be?
When you are looking for an element by id, this is going to eventually come down to
document.getElementById() execution which is blazingly fast and highly optimized by the modern browsers.
XPath location strategy in this case requires traversing the whole HTML tree even though having the id attribute check is usually optimized in XPath engines.
It depends what you mean by different. Best practice would be to use a static ID of some kind, either whether a test ID or through an element ID - as long as it's 1) unique and 2) static.
XPath isn't ideal as it's relative to other elements on the page, meaning it's liable to change fairly often.
ID have high priority over the xpath
priority of locators
Nothing different as you feel. It is also a type under locators. If you didn't find element locators like id, name, link text etc. Last way you can choose or locate the "Xpath". Better way to find xpath is by using "Firebug and Firepath". It makes to find locators easily.