The webdriver.switchTo().frame() method can take a name or an id. It would have to search the DOM (Document Object Model) for the name or id. You can have multiple things on a page with the same name attribute. So using id attributes tend to be faster. However, if the computer running the browser is slow and/or there are a lot of attributes in the DOM, it could take a while to switch frames.
There is also a webdriver.switchTo().frame() method which takes an index. So if you know it is frame number 1 you can just use webdriver.switchTo().frame(1). But if the order of the frames may change this is not helpful. You can also use a WebElement to switch frames. So sometimes the webdriver.findElement() method will find the frame faster and switching to this WebElement will be faster.
This is really getting more into optimizing your code to be faster.