In Automation, while we use CSS to define page elements, We can define as below ways for a sample page element:
element :fld_page_element, "#uniqueID .some-class-name"
OR,
element :fld_page_element, "[id='uniqueID'] [class='some-class-name']"
Where # symbol represents ID and . represents class attribute name.
What's the difference between them in performance wise while Test Automation comes to the picture? Or is there any advantage using over other? If it is, Please share with me.
I think, you are trying to do premature optimization.
When you are designing tests, you should aim for the best "user" (i.e. developer) experience - write the readable tests which, when fail, present a clear message. As said in comments, you can spend a lot of time debugging the strangely written test, which can be a tenfold of time the "slow but readable" version of the same test would run.
If you find your test suite to be too slow, find out the most slow tests using the tools provided by your testing framework (rspec can show the list of the slowest tests, minitest, if I remember correctly, contains tools to benchmark something, etc.) and optimize them. Most of the time, though, you would find that these tests are slow for other reasons than one you've stated.
UPD: Take a loot at this: http://www.shouldioptimize.com/
It allowes you to check how much computing hours of AWS EC2 instance time you can buy for what you're paid by your customer/company per hour.
From their "Why" page:
(Note the "across FIVE YEARS" stuff in the header of the image)